Comparing version 1.6.0 to 1.7.0
@@ -61,3 +61,3 @@ var util = require('./util.js'), | ||
var name = '', mod; | ||
if (alias = getTag(d.tags, 'alias')) { | ||
if (alias = getTag(d.tags, ['alias', 'function', 'func', 'method'])) { | ||
name = alias.string; | ||
@@ -108,3 +108,3 @@ } else if (mod = getTag(d.tags, 'module')) { | ||
if (returns = getTag(d.tags, 'returns') || getTag(d.tags, 'return')) { | ||
if (returns = getTag(d.tags, ['returns', 'return'])) { | ||
log('\n**Returns** `%s`, %s\n', returns.types.join(','), reformat(returns.description)); | ||
@@ -111,0 +111,0 @@ } |
{ | ||
"name": "doxme", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "create markdown docs for dox output", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -38,3 +38,9 @@ var test = require('tape'), | ||
}); | ||
t.test('@function tag', function(t) { | ||
var result = doxme(dox.parseComments(fs.readFileSync('./test/function.js', 'utf8'))); | ||
if (process.env.UPDATE) { fs.writeFileSync('test/function.md', result); } | ||
t.equal(result, fs.readFileSync('test/function.md', 'utf8')); | ||
t.end(); | ||
}); | ||
t.end(); | ||
}); |
18
util.js
var striptags = require('striptags'); | ||
function find (array, func) { | ||
if (!Array.isArray(array)) return undefined; | ||
var index = 0, length = array.length; | ||
while (index < length) { | ||
if (func(array[index], index, array)) return array[index]; | ||
index++; | ||
} | ||
} | ||
module.exports.getTags = function(tags, type) { | ||
@@ -7,4 +17,8 @@ return tags.filter(function(t) { return t.type === type; }); | ||
module.exports.getTag = function(tags, type) { | ||
return tags.filter(function(t) { return t.type === type; })[0]; | ||
module.exports.getTag = function getTag (tags, type) { | ||
if (Array.isArray(type)) return getTag( | ||
tags, | ||
find(type, function (singleType) { return getTag(tags, singleType); }) | ||
); | ||
return find(tags, function(t) { return t.type === type; }); | ||
}; | ||
@@ -11,0 +25,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13676
15
187
6