Skip to content

Commit dabda69

Browse files
committed
Tidy up js docs order
1 parent 1028926 commit dabda69

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

js/js.go

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
// | | false † | false |
2525
// | | new Boolean(false) † | false |
2626
// |---------------------------------+------------------------------------+-----------------------------------------------|
27-
// | time.Time | null | time.Time{} |
28-
// | | undefined | time.Time{} |
29-
// | | new Date(Date.UTC(2017, 0, 1)) † | time.Date(2017, 1, 1, 0, 0, 0, 0, time.UTC) |
30-
// |---------------------------------+------------------------------------+-----------------------------------------------|
3127
// | int, int8, | null | 0 |
3228
// | int16, int32, | undefined | 0 |
3329
// | int64 | 1 † | 1 |
@@ -43,25 +39,32 @@
4339
// | | 1 † | 1 |
4440
// | | new Number(1) † | 1 |
4541
// |---------------------------------+------------------------------------+-----------------------------------------------|
42+
// | Non *js.Object-special struct | n/a - runtime exception | n/a - runtime exception |
43+
// | types | | |
44+
// |---------------------------------+------------------------------------+-----------------------------------------------|
45+
// | Pointer types (excluding | n/a - runtime exception | n/a - runtime exception |
46+
// | *js.Object-special struct types | | |
47+
// | and *js.Object | | |
48+
// |---------------------------------+------------------------------------+-----------------------------------------------|
4649
// | [n]V - array type | null | [n]V{} |
4750
// | length n and | undefined | [n]V{} |
4851
// | element type V | new Array(n) | [n]V{} |
4952
// | | new Array(v1, v2, ... vn) | [n]V{v1, v2, ... vn} |
5053
// | | new TypedArray(n) ‡ | [n]V{} |
5154
// |---------------------------------+------------------------------------+-----------------------------------------------|
52-
// | []V - slice type | null | ([]V)(nil) |
53-
// | element type V | undefined | ([]V)(nil) |
54-
// | | new Array(n) | ([]V)(nil) |
55+
// | []V - slice type | null | (nil) |
56+
// | element type V | undefined | (nil) |
57+
// | | new Array(n) | (nil) |
5558
// | | new Array(v1, v2, ... vn) | [n]V{v1, v2, ... vn} |
56-
// | | new TypedArray(n) ‡ | ([]V)(nil) |
59+
// | | new TypedArray(n) ‡ | (nil) |
5760
// |---------------------------------+------------------------------------+-----------------------------------------------|
58-
// | map[K]V | null | (map[K]V)(nil) |
59-
// | | undefined | (map[K]V)(nil) |
61+
// | map[K]V | null | nil |
62+
// | | undefined | nil |
6063
// | map[string]bool | Object({"1": true}) | map[string]bool{"1": true} |
6164
// | map[interface{}]int | Object({"ok": 5}) | map[interface{}]int{"ok": 5} |
6265
// |---------------------------------+------------------------------------+-----------------------------------------------|
63-
// | func(a1 A1, a2 A2, ... an AN) | null | (func type)(nil) |
64-
// | (r1 R1, r2, R2, ... rn RN) | undefined | (func type)(nil) |
66+
// | func(a1 A1, a2 A2, ... an AN) | null | nil |
67+
// | (r1 R1, r2, R2, ... rn RN) | undefined | nil |
6568
// | | Any Function | wrapped func val that externalizes args, |
6669
// | | | and internalizes results |
6770
// |---------------------------------+------------------------------------+-----------------------------------------------|
@@ -73,19 +76,21 @@
7376
// | | | values, the result is a value of type |
7477
// | | | func(vals ...interface{}) *js.Object |
7578
// |---------------------------------+------------------------------------+-----------------------------------------------|
79+
// | time.Time | null | time.Time{} |
80+
// | | undefined | time.Time{} |
81+
// | | new Date(Date.UTC(2017, 0, 1)) † | time.Date(2017, 1, 1, 0, 0, 0, 0, time.UTC) |
82+
// |---------------------------------+------------------------------------+-----------------------------------------------|
7683
// | *js.Object | Any value | same value - internalization does nothing |
7784
// |---------------------------------+------------------------------------+-----------------------------------------------|
78-
// | *js.Object-special struct types | null | new(T) |
79-
// | *T where T is declared as: | undefined | new(T) |
85+
// | *js.Object-special struct types | null | nil |
86+
// | *T where T is declared as: | undefined | nil |
8087
// | | Any other value v | &T{o: v} |
8188
// |   type T struct { | | |
8289
// |    o *js.Object | | |
8390
// |    | | |
8491
// |    // fields (with js tags) | | |
8592
// |   } | | |
8693
// |---------------------------------+------------------------------------+-----------------------------------------------|
87-
// | Other struct types | n/a - runtime exception | n/a - runtime exception |
88-
// |---------------------------------+------------------------------------+-----------------------------------------------|
8994
//
9095
// Any source values not listed in this table cause a runtime panic for a given
9196
// target type if a conversion is attempted, e.g. a Javascript number value
@@ -129,31 +134,29 @@
129134
// |-------------------------------------------+--------------------+---------------------------------------------+-----------+-------------|
130135
// | All numerics types | All valid values | n | number | Number |
131136
// |-------------------------------------------+--------------------+---------------------------------------------+-----------+-------------|
132-
// | Slice and array types | All valid values | new Array(v1, v2, ... vn) | object | Array |
133-
// |-------------------------------------------+--------------------+---------------------------------------------+-----------+-------------|
134-
// | Map types | All valid values | Object({k1: v2, k2: v2, ... kn: vn}) | object | Object |
135-
// | | | where k1 is the string value of the | | |
136-
// | | | externalized source key k1, v1 is the | | |
137-
// | | | externalized value v1, etc. | | |
138-
// |-------------------------------------------+--------------------+---------------------------------------------+-----------+-------------|
139137
// | Struct values, pointers to struct | All valid values | Object with properties | object | Object |
140138
// | values (excluding *js.Object-special | | set for all exported fields. | | |
141139
// | struct types) | | Property values are externalized | | |
142140
// | | | Go values. | | |
143141
// |-------------------------------------------+--------------------+---------------------------------------------+-----------+-------------|
144142
// | Any type of pointer (excluding *js.Object | All valid values | Externalized result of the value being | * | * |
145143
// | and *js.Object-special struct values) | | pointed to | | |
146-
// | | | | | |
147-
// | | | | | |
148144
// |-------------------------------------------+--------------------+---------------------------------------------+-----------+-------------|
149-
// | time.Time, *time.Time | All valid values | Corresponding Date value | object | Date |
145+
// | Slice and array types | All valid values | new Array(v1, v2, ... vn) | object | Array |
146+
// |-------------------------------------------+--------------------+---------------------------------------------+-----------+-------------|
147+
// | Map types | All valid values | Object({k1: v2, k2: v2, ... kn: vn}) | object | Object |
148+
// | | | where k1 is the Javascript String value of | | |
149+
// | | | the externalized source key k1, v1 is the | | |
150+
// | | | externalized value v1, etc. | | |
150151
// |-------------------------------------------+--------------------+---------------------------------------------+-----------+-------------|
151152
// | func(a1 A1, a2 A2, ... an AN) | nil | undefined | undefined | n/a |
152153
// | (r1 R1, r2, R2, ... rn RN) | Non-nil value | Function value that wraps the Go func, | function | Function |
153154
// | | | internalizes args and externalizes results | | |
154155
// |-------------------------------------------+--------------------+---------------------------------------------+-----------+-------------|
155156
// | Any interface value | All valid values | Externalized result of the underlying value | * | * |
156157
// |-------------------------------------------+--------------------+---------------------------------------------+-----------+-------------|
158+
// | time.Time | All valid values | Corresponding Date value | object | Date |
159+
// |-------------------------------------------+--------------------+---------------------------------------------+-----------+-------------|
157160
// | *js.Object | Any value | Same value - externalization does nothing | * | * |
158161
// |-------------------------------------------+--------------------+---------------------------------------------+-----------+-------------|
159162
// | *js.Object-special struct types | All valid values v | v.o | * | * |
@@ -176,6 +179,7 @@
176179
// † - Source values annotated with † are generally applicable to all valid
177180
// values of the target type. e.g. for target type string, "ok" represents
178181
// all valid string primitive values.
182+
//
179183
package js
180184

181185
// Object is a container for a native JavaScript object. Calls to its methods are treated specially by GopherJS and translated directly to their JavaScript syntax. A nil pointer to Object is equal to JavaScript's "null". Object can not be used as a map key.

0 commit comments

Comments
 (0)