Comparing version
{ | ||
"name": "getdocs", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "An extractor for succinct documentation comments in JavaScript code", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -104,4 +104,5 @@ # Getdocs | ||
A tag like `#deprecated`, for example, will result in a `tags: | ||
{deprecated: "true"}` property on the given item. | ||
A tag like `#deprecated`, for example, will result in a `$deprecated: | ||
"true"` property on the given item. The property is named by | ||
prepending the tag's name with a dollar sign. | ||
@@ -123,4 +124,4 @@ You can give tags an explicit value other than `"true"` by writing an | ||
* **kind**: Explicitly sets the kind of this item. Is stored directly | ||
on the item data, rather than under a `tags` object. | ||
* **kind**: Explicitly sets the kind of this item. Does not get a | ||
dollar sign prefix. | ||
@@ -127,0 +128,0 @@ * **forward**: Can be used to make the properties or methods of a |
@@ -115,7 +115,3 @@ var acorn = require("acorn/dist/acorn") | ||
if (value.charAt(0) == '"') value = JSON.parse(value) | ||
if (directTags.hasOwnProperty(match[1])) { | ||
data[match[1]] = value | ||
} else { | ||
;(data.tags || (data.tags = Object.create(null)))[match[1]] = value | ||
} | ||
data[directTags.hasOwnProperty(match[1]) ? match[1] : "$" + match[1]] = value | ||
} | ||
@@ -122,0 +118,0 @@ if (/\S/.test(text)) data.description = text |
@@ -13,4 +13,4 @@ var docComments = require("./doccomments") | ||
var data = comment.data | ||
if (data.tags && data.tags.path) { | ||
var path = splitPath(data.tags.path) | ||
if (data.$path) { | ||
var path = splitPath(data.$path) | ||
posFromPath(items, path).add(data) | ||
@@ -31,4 +31,4 @@ if (!data.kind && data.type) { | ||
if (data.tags && data.tags.forward) { | ||
top.forward = splitPath(data.tags.forward) | ||
if (data.$forward) { | ||
top.forward = splitPath(data.$forward) | ||
} else { | ||
@@ -35,0 +35,0 @@ var pos = findPos[top.type](top, stack) |
@@ -29,5 +29,3 @@ { | ||
], | ||
"tags": { | ||
"path": "Boo#event.start" | ||
}, | ||
"$path": "Boo#event.start", | ||
"kind": "event", | ||
@@ -34,0 +32,0 @@ "description": "Start event" |
@@ -9,5 +9,3 @@ { | ||
"kind": "class", | ||
"tags": { | ||
"path": "Abc" | ||
}, | ||
"$path": "Abc", | ||
"description": "The Abc class", | ||
@@ -42,5 +40,3 @@ "instanceProperties": { | ||
}, | ||
"tags": { | ||
"path": "Abc.prototype.m1" | ||
}, | ||
"$path": "Abc.prototype.m1", | ||
"description": "Method #1" | ||
@@ -58,7 +54,5 @@ } | ||
"type": "string", | ||
"tags": { | ||
"path": "myString" | ||
}, | ||
"$path": "myString", | ||
"description": "My string" | ||
} | ||
} |
@@ -8,7 +8,5 @@ { | ||
}, | ||
"tags": { | ||
"deprecated": "true", | ||
"exported": "false", | ||
"context": "a \"string\"" | ||
}, | ||
"$deprecated": "true", | ||
"$exported": "false", | ||
"$context": "a \"string\"", | ||
"description": "Hello!", | ||
@@ -15,0 +13,0 @@ "kind": "function", |
188
0.53%45890
-0.5%1504
-0.92%