You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More correct parsing for kind shorthand (@Class, @constant, etc)
* Set the `kind` property of the comment, not a property named by the kind.
* Set the `type` property as appropriate for these shorthands.
* Parse @callback as shorthand for @typedef {Function}
Copy file name to clipboardExpand all lines: test/fixture/class.output.json
+2-5
Original file line number
Diff line number
Diff line change
@@ -95,9 +95,8 @@
95
95
"code": "/**\n * This is my class, a demo thing.\n * @class MyClass\n * @property {number} howMany how many things it contains\n */\nfunction MyClass() {\n this.howMany = 2;\n}\n\n/**\n * Get the number 42\n * @param {boolean} getIt whether to get the number\n * @returns {number} forty-two\n */\nMyClass.prototype.getFoo = function (getIt) {\n return getIt ? 42 : 0;\n};\n\n/**\n * Get undefined\n * @returns {undefined} does not return anything.\n */\nMyClass.prototype.getUndefined = function () { };\n"
Copy file name to clipboardExpand all lines: test/fixture/params.output.json
+4-10
Original file line number
Diff line number
Diff line change
@@ -177,9 +177,8 @@
177
177
"code": "/**\n * This function returns the number one.\n * @param {number} b the second param\n */\nfunction addThem(a, b, c, { d, e, f }) {\n return a + b + c + d + e + f;\n}\n\n/**\n * This method has partially inferred params\n * @param {String} $0.fishes number of kinds of fish\n */\nfunction fishesAndFoxes({ fishes, foxes }) {\n return fishes + foxes;\n}\n\n/**\n * This method has a type in the description and a default in the code\n * @param {number} x\n */\nfunction withDefault(x = 2) {\n return x;\n}\n\n/**\n * This is foo's documentation\n */\nclass Foo {\n /**\n * The method\n * @param {number} x Param to method\n */\n method(x) {\n }\n}\n\n/**\n * Represents an IPv6 address\n *\n * This tests our support of optional parameters\n * @class Address6\n * @param {string} address - An IPv6 address string\n * @param {number} [groups=8] - How many octets to parse\n * @param {?number} third - A third argument\n * @param {Array} [foo=[1]] to properly be parsed\n * @example\n * var address = new Address6('2001::/32');\n */\nfunction Address6() {}\n\n/**\n * Create a GeoJSON data source instance given an options object\n *\n * This tests our support of nested parameters\n * @class GeoJSONSource\n * @param {Object} [options] optional options\n * @param {Object|string} options.data A GeoJSON data object or URL to it.\n * The latter is preferable in case of large GeoJSON files.\n * @param {number} [options.maxzoom=14] Maximum zoom to preserve detail at.\n * @param {number} [options.buffer] Tile buffer on each side.\n * @param {number} [options.tolerance] Simplification tolerance (higher means simpler).\n */\nfunction GeoJSONSource(options) {\n this.options = options;\n}\n\n/**\n * This tests our support for parameters with explicit types but with default\n * values specified in code.\n *\n * @param {number} x an argument\n *\n * @returns {number} some\n */\nexport const myfunc = (x = 123) => x;\n\n/**\n * This tests our support of JSDoc param tags without type information,\n * or any type information we could infer from annotations.\n *\n * @param address - An IPv6 address string\n */\nfunction foo(address) {\n return address;\n}\n"
178
178
},
179
179
"errors": [],
180
-
"class": {
181
-
"name": "Address6"
182
-
},
180
+
"kind": "class",
181
+
"name": "Address6",
183
182
"params": [
184
183
{
185
184
"name": "address",
@@ -437,8 +436,6 @@
437
436
"description": "var address = new Address6('2001::/32');"
438
437
}
439
438
],
440
-
"name": "Address6",
441
-
"kind": "class",
442
439
"members": {
443
440
"instance": [],
444
441
"static": []
@@ -1423,9 +1420,8 @@
1423
1420
"code": "/**\n * This function returns the number one.\n * @param {number} b the second param\n */\nfunction addThem(a, b, c, { d, e, f }) {\n return a + b + c + d + e + f;\n}\n\n/**\n * This method has partially inferred params\n * @param {String} $0.fishes number of kinds of fish\n */\nfunction fishesAndFoxes({ fishes, foxes }) {\n return fishes + foxes;\n}\n\n/**\n * This method has a type in the description and a default in the code\n * @param {number} x\n */\nfunction withDefault(x = 2) {\n return x;\n}\n\n/**\n * This is foo's documentation\n */\nclass Foo {\n /**\n * The method\n * @param {number} x Param to method\n */\n method(x) {\n }\n}\n\n/**\n * Represents an IPv6 address\n *\n * This tests our support of optional parameters\n * @class Address6\n * @param {string} address - An IPv6 address string\n * @param {number} [groups=8] - How many octets to parse\n * @param {?number} third - A third argument\n * @param {Array} [foo=[1]] to properly be parsed\n * @example\n * var address = new Address6('2001::/32');\n */\nfunction Address6() {}\n\n/**\n * Create a GeoJSON data source instance given an options object\n *\n * This tests our support of nested parameters\n * @class GeoJSONSource\n * @param {Object} [options] optional options\n * @param {Object|string} options.data A GeoJSON data object or URL to it.\n * The latter is preferable in case of large GeoJSON files.\n * @param {number} [options.maxzoom=14] Maximum zoom to preserve detail at.\n * @param {number} [options.buffer] Tile buffer on each side.\n * @param {number} [options.tolerance] Simplification tolerance (higher means simpler).\n */\nfunction GeoJSONSource(options) {\n this.options = options;\n}\n\n/**\n * This tests our support for parameters with explicit types but with default\n * values specified in code.\n *\n * @param {number} x an argument\n *\n * @returns {number} some\n */\nexport const myfunc = (x = 123) => x;\n\n/**\n * This tests our support of JSDoc param tags without type information,\n * or any type information we could infer from annotations.\n *\n * @param address - An IPv6 address string\n */\nfunction foo(address) {\n return address;\n}\n"
0 commit comments