Comparing version 1.0.6 to 1.0.7
72
doxli.js
@@ -5,2 +5,3 @@ var util = require('util'); | ||
var djs = null; | ||
var pHeader = false; | ||
@@ -23,40 +24,39 @@ function getdox(name) { | ||
console.log(name + '\n' + desc.replace(/(<([^>]+)>)/ig,"") + '\n'); | ||
printTags(tags); | ||
} | ||
} | ||
function printTags(tags) { | ||
var i = 0; | ||
var p = 0; | ||
var op = ""; | ||
paramHeader = false; | ||
for (i = 0; i < tags.length; i++) { | ||
switch(tags[i].type) { | ||
case 'example': | ||
console.log("Example:\n" + tags[i].string); | ||
break; | ||
case 'param': | ||
if(!p) { | ||
console.log("Parameters:"); | ||
p++; | ||
} | ||
op = tags[i].optional ? "Optional. " : " "; | ||
console.log( | ||
' ' + tags[i].name + | ||
' (' + tags[i].types.toString() + ') - ' + | ||
op + tags[i].description + '\n' | ||
); | ||
break; | ||
case 'return': | ||
console.log( | ||
'Returns:\n (' + | ||
tags[i].types.toString() + | ||
') - ' + tags[i].description + '\n' | ||
); | ||
break; | ||
default: | ||
break; | ||
} | ||
const t = tags[i]; | ||
const result = printTag(t); | ||
} | ||
} | ||
} | ||
module.exports = function (mod) { | ||
var i; | ||
var path; | ||
for (i in require.cache) { | ||
function printTag(t) { | ||
switch(t.type) { | ||
case 'example': | ||
console.log("Example:\n" + t.string); | ||
break; | ||
case 'param': | ||
if(!paramHeader) { | ||
console.log("Parameters:"); | ||
paramHeader = true; | ||
} | ||
var op = t.optional ? "Optional. " : " "; | ||
console.log( ` ${t.name} (${t.types.toString()}) - ${op}${t.description}\n`); | ||
break; | ||
case 'return': | ||
console.log(`Returns:\n (${t.types.toString()}) - ${t.description}\n`); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
function getCachedPath(mod) { | ||
let path = null; | ||
for (var i in require.cache) { | ||
if (mod === require.cache[i].exports) { | ||
@@ -66,2 +66,7 @@ path = require.cache[i].filename; | ||
} | ||
return path; | ||
} | ||
function doxli(mod) { | ||
var path = getCachedPath(mod);; | ||
djs = dox.parseComments(fs.readFileSync(path).toString()); | ||
@@ -77,1 +82,2 @@ if (typeof mod === 'object') { | ||
module.exports = doxli; |
{ | ||
"name": "doxli", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Get jsdoc / dox documentation for modules on the command line.", | ||
"main": "doxli.js", | ||
"scripts": { | ||
"test": "test/test.js" | ||
"test": "test/test.js", | ||
"lint": "node node_modules/.bin/eslint **/*.js" | ||
}, | ||
@@ -27,3 +28,6 @@ "repository": { | ||
"dox": "^0.9.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^7.21.0" | ||
} | ||
} |
@@ -14,3 +14,4 @@ doxli | ||
<img src="http://npm.packagequality.com/badge/doxli.png"/> | ||
<a href="https://codeclimate.com/github/73rhodes/doxli/maintainability"><img src="https://api.codeclimate.com/v1/badges/4a08cd1e22c0203c0df3/maintainability" /></a> | ||
<img src="https://packagequality.com/shield/doxli.svg"/> | ||
@@ -17,0 +18,0 @@ Usage |
@@ -34,5 +34,6 @@ var doxli = require('../doxli'); | ||
exports.countfoo = function (foostring, barstring) { | ||
return foostring.match(/foo/g).length; | ||
const tmp = barstring || 1; | ||
return tmp && foostring.match(/foo/g).length; | ||
}; | ||
doxli(this); |
@@ -12,3 +12,2 @@ /** | ||
*/ | ||
exports.escape = function (html) { | ||
@@ -33,5 +32,5 @@ return String(html) | ||
*/ | ||
exports.countfoo = function (foostring, barstring) { | ||
return foostring.match(/foo/g).length; | ||
const tmp = barstring || 1; | ||
return tmp && foostring.match(/foo/g).length; | ||
}; |
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
5978
8
179
41
1