Socket
Socket
Sign inDemoInstall

dox

Package Overview
Dependencies
Maintainers
3
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dox - npm Package Compare versions

Comparing version 0.9.1 to 1.0.0

5

History.md

@@ -0,1 +1,6 @@

1.0.0 / 2022-09-06
==================
* jsdoctypeparser finally updated to latest version
0.9.1 / 2022-04-26

@@ -2,0 +7,0 @@ ==================

62

lib/dox.js

@@ -409,16 +409,46 @@ /*!

}
var Parser = require('jsdoctypeparser').Parser;
var Builder = require('jsdoctypeparser').Builder;
var result = new Parser().parse(str.substr(1, str.length - 2));
var {parse, publish, createDefaultPublisher, NodeType, SyntaxType} = require('jsdoctypeparser');
var result = parse(str.substring(1, str.length - 1));
var customPublisher = Object.assign({}, createDefaultPublisher(), {
NAME(nameNode) {
var output = '<code>' + nameNode.name + '</code>';
if (result.type === NodeType.OPTIONAL) {
output += '|<code>undefined</code>';
} else if (result.type === NodeType.NULLABLE) {
output += '|<code>null</code>';
}
return output;
}
});
var types = (function transform(type) {
if(type instanceof Builder.TypeUnion) {
return type.types.map(transform);
} else if(type instanceof Builder.TypeName) {
return type.name;
} else if(type instanceof Builder.RecordType) {
return type.entries.reduce(function(obj, entry) {
obj[entry.name] = transform(entry.typeUnion);
if (type && type.type === NodeType.UNION) {
return [transform(type.left), transform(type.right)].flat();
} else if (type && type.type === NodeType.NAME) {
return [type.name];
} else if (type && type.type === NodeType.RECORD) {
return [type.entries.reduce(function (obj, entry) {
obj[entry.key] = transform(entry.value);
return obj;
}, {});
}, {})];
} else if (type && type.type === NodeType.GENERIC) {
if (type.meta.syntax === SyntaxType.GenericTypeSyntax.ANGLE_BRACKET) {
return [type.subject.name + '<' + transform(type.objects[0]).join('|') + '>'];
} else if (type.meta.syntax === SyntaxType.GenericTypeSyntax.ANGLE_BRACKET_WITH_DOT) {
return [type.subject.name + '.<' + transform(type.objects[0]).join('|') + '>'];
} else if (type.meta.syntax === SyntaxType.GenericTypeSyntax.SQUARE_BRACKET) {
return [type.subject.name + '[' + transform(type.objects[0]).join('|') + ']'];
} else if (type.meta.syntax === SyntaxType.VariadicTypeSyntax.PREFIX_DOTS) {
return [`...${type.subject.name}`];
} else if (type.meta.syntax === SyntaxType.VariadicTypeSyntax.SUFFIX_DOTS) {
return [`${type.subject.name}...`];
} else if (type.meta.syntax === SyntaxType.VariadicTypeSyntax.ONLY_DOTS) {
return ['...'];
}
return [type.subject.name]
} else if (type && type.value) {
return transform(type.value);
} else {

@@ -431,7 +461,7 @@ return type.toString();

tag.types = types;
tag.typesDescription = result.toHtml();
tag.optional = (tag.name && tag.name.slice(0,1) === '[') || result.optional;
tag.nullable = result.nullable;
tag.nonNullable = result.nonNullable;
tag.variable = result.variable;
tag.typesDescription = publish(result, customPublisher).replace(/^\?|=$/, '');
tag.optional = (tag.name && tag.name.slice(0,1) === '[') || result.type === NodeType.OPTIONAL;
tag.nullable = result.type === NodeType.NULLABLE;
tag.nonNullable = result.meta ? result.meta.syntax === 'SUFFIX_QUESTION_MARK' || result.meta.syntax === 'PREFIX_BANG': false;
tag.variable = result.type === NodeType.VARIADIC;
}

@@ -438,0 +468,0 @@

{
"name": "dox",
"description": "Markdown / JSdoc documentation generator",
"version": "0.9.1",
"version": "1.0.0",
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -31,8 +31,8 @@ "contributors": [

"dependencies": {
"commander": "9.1.0",
"jsdoctypeparser": "^1.2.0",
"markdown-it": "12.3.2"
"commander": "9.4.0",
"jsdoctypeparser": "^9.0.0",
"markdown-it": "13.0.1"
},
"devDependencies": {
"mocha": "9.2.2",
"mocha": "10.0.0",
"should": "13.2.3"

@@ -39,0 +39,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc