doctrine
Advanced tools
Comparing version 2.0.0 to 2.0.2
@@ -0,1 +1,16 @@ | ||
v2.0.2 - November 25, 2017 | ||
* 5049ee3 Fix: Remove redundant LICENSE/README names from files (#203) (Kevin Partington) | ||
v2.0.1 - November 10, 2017 | ||
* 009f33d Fix: Making sure union type stringification respects compact flag (#199) (Mitermayer Reis) | ||
* 19da935 Use native String.prototype.trim instead of a custom implementation. (#201) (Rouven Weßling) | ||
* e3a011b chore: add mocha.opts to restore custom mocha config (Jason Kurian) | ||
* d888200 chore: adds nyc and a newer version of mocha to accurately report coverage (Jason Kurian) | ||
* 6b210a8 fix: support type expression for @this tag (fixes #181) (#182) (Frédéric Junod) | ||
* 1c4a4c7 fix: Allow array indexes in names (#193) (Tom MacWright) | ||
* 9aed54d Fix incorrect behavior when arrow functions are used as default values (#189) (Gaurab Paul) | ||
* 9efb6ca Upgrade: Use Array.isArray instead of isarray package (#195) (medanat) | ||
v2.0.0 - November 15, 2016 | ||
@@ -2,0 +17,0 @@ |
@@ -13,3 +13,2 @@ /* | ||
utility, | ||
isArray, | ||
jsdoc, | ||
@@ -20,3 +19,2 @@ esutils, | ||
esutils = require('esutils'); | ||
isArray = require('isarray'); | ||
typed = require('./typed'); | ||
@@ -97,6 +95,2 @@ utility = require('./utility'); | ||
function trim(str) { | ||
return str.replace(/^\s+/, '').replace(/\s+$/, ''); | ||
} | ||
function unwrapComment(doc) { | ||
@@ -274,3 +268,3 @@ // JSDoc comment is following form | ||
var identifier; | ||
if (!esutils.code.isIdentifierStartES5(source.charCodeAt(index))) { | ||
if (!esutils.code.isIdentifierStartES5(source.charCodeAt(index)) && !source[index].match(/[0-9]/)) { | ||
return null; | ||
@@ -303,11 +297,11 @@ } | ||
if (allowBrackets && source.charCodeAt(index) === 0x5B /* '[' */) { | ||
useBrackets = true; | ||
name = advance(); | ||
if (source.charCodeAt(index) === 0x5B /* '[' */) { | ||
if (allowBrackets) { | ||
useBrackets = true; | ||
name = advance(); | ||
} else { | ||
return null; | ||
} | ||
} | ||
if (!esutils.code.isIdentifierStartES5(source.charCodeAt(index))) { | ||
return null; | ||
} | ||
name += scanIdentifier(last); | ||
@@ -533,4 +527,4 @@ | ||
assign = name.substring(1, name.length - 1).split('='); | ||
if (assign[1]) { | ||
this._tag['default'] = assign[1]; | ||
if (assign.length > 1) { | ||
this._tag['default'] = assign.slice(1).join('='); | ||
} | ||
@@ -555,3 +549,3 @@ this._tag.name = assign[0]; | ||
TagParser.prototype.parseDescription = function parseDescription() { | ||
var description = trim(sliceSource(source, index, this._last)); | ||
var description = sliceSource(source, index, this._last).trim(); | ||
if (description) { | ||
@@ -567,3 +561,3 @@ if ((/^-\s+/).test(description)) { | ||
TagParser.prototype.parseCaption = function parseDescription() { | ||
var description = trim(sliceSource(source, index, this._last)); | ||
var description = sliceSource(source, index, this._last).trim(); | ||
var captionStartTag = '<caption>'; | ||
@@ -574,5 +568,5 @@ var captionEndTag = '</caption>'; | ||
if (captionStart >= 0 && captionEnd >= 0) { | ||
this._tag.caption = trim(description.substring( | ||
captionStart + captionStartTag.length, captionEnd)); | ||
this._tag.description = trim(description.substring(captionEnd + captionEndTag.length)); | ||
this._tag.caption = description.substring( | ||
captionStart + captionStartTag.length, captionEnd).trim(); | ||
this._tag.description = description.substring(captionEnd + captionEndTag.length).trim(); | ||
} else { | ||
@@ -599,3 +593,3 @@ this._tag.description = description; | ||
}; | ||
kind = trim(sliceSource(source, index, this._last)); | ||
kind = sliceSource(source, index, this._last).trim(); | ||
this._tag.kind = kind; | ||
@@ -612,3 +606,3 @@ if (!hasOwnProperty(kinds, kind)) { | ||
var access; | ||
access = trim(sliceSource(source, index, this._last)); | ||
access = sliceSource(source, index, this._last).trim(); | ||
this._tag.access = access; | ||
@@ -623,9 +617,9 @@ if (access !== 'private' && access !== 'protected' && access !== 'public') { | ||
TagParser.prototype.parseThis = function parseAccess() { | ||
// this name may be a name expression (e.g. {foo.bar}) | ||
// or a name path (e.g. foo.bar) | ||
var value = trim(sliceSource(source, index, this._last)); | ||
TagParser.prototype.parseThis = function parseThis() { | ||
// this name may be a name expression (e.g. {foo.bar}), | ||
// an union (e.g. {foo.bar|foo.baz}) or a name path (e.g. foo.bar) | ||
var value = sliceSource(source, index, this._last).trim(); | ||
if (value && value.charAt(0) === '{') { | ||
var gotType = this.parseType(); | ||
if (gotType && this._tag.type.type === 'NameExpression') { | ||
if (gotType && this._tag.type.type === 'NameExpression' || this._tag.type.type === 'UnionType') { | ||
this._tag.name = this._tag.type.name; | ||
@@ -643,3 +637,3 @@ return true; | ||
var variation, text; | ||
text = trim(sliceSource(source, index, this._last)); | ||
text = sliceSource(source, index, this._last).trim(); | ||
variation = parseFloat(text, 10); | ||
@@ -656,3 +650,3 @@ this._tag.variation = variation; | ||
TagParser.prototype.ensureEnd = function () { | ||
var shouldBeEmpty = trim(sliceSource(source, index, this._last)); | ||
var shouldBeEmpty = sliceSource(source, index, this._last).trim(); | ||
if (shouldBeEmpty) { | ||
@@ -838,3 +832,3 @@ if (!this.addError('Unknown content \'%0\'', shouldBeEmpty)) { | ||
return preserveWhitespace ? description : trim(description); | ||
return preserveWhitespace ? description : description.trim(); | ||
} | ||
@@ -857,3 +851,3 @@ | ||
if (options.tags) { | ||
if (isArray(options.tags)) { | ||
if (Array.isArray(options.tags)) { | ||
interestingTags = { }; | ||
@@ -860,0 +854,0 @@ for (i = 0, iz = options.tags.length; i < iz; i++) { |
@@ -1136,3 +1136,3 @@ /* | ||
if ((i + 1) !== iz) { | ||
result += '|'; | ||
result += compact ? '|' : ' | '; | ||
} | ||
@@ -1139,0 +1139,0 @@ } |
@@ -6,3 +6,3 @@ { | ||
"main": "lib/doctrine.js", | ||
"version": "2.0.0", | ||
"version": "2.0.2", | ||
"engines": { | ||
@@ -15,7 +15,3 @@ "node": ">=0.10.0" | ||
"files": [ | ||
"lib", | ||
"LICENSE.BSD", | ||
"LICENSE.closure-compiler", | ||
"LICENSE.esprima", | ||
"README.md" | ||
"lib" | ||
], | ||
@@ -40,6 +36,6 @@ "maintainers": [ | ||
"eslint-release": "^0.10.0", | ||
"istanbul": "^0.4.1", | ||
"linefix": "^0.1.1", | ||
"mocha": "^2.3.3", | ||
"mocha": "^3.4.2", | ||
"npm-license": "^0.3.1", | ||
"nyc": "^10.3.2", | ||
"semver": "^5.0.3", | ||
@@ -52,3 +48,5 @@ "shelljs": "^0.5.3", | ||
"scripts": { | ||
"test": "npm run lint && node Makefile.js test", | ||
"pretest": "npm run lint", | ||
"test": "nyc mocha", | ||
"coveralls": "nyc report --reporter=text-lcov | coveralls", | ||
"lint": "eslint lib/", | ||
@@ -61,5 +59,4 @@ "release": "eslint-release", | ||
"dependencies": { | ||
"esutils": "^2.0.2", | ||
"isarray": "^1.0.0" | ||
"esutils": "^2.0.2" | ||
} | ||
} |
102535
1
1918
- Removedisarray@^1.0.0
- Removedisarray@1.0.0(transitive)