Socket
Socket
Sign inDemoInstall

api-doc-validator

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-doc-validator - npm Package Compare versions

Comparing version 2.19.1 to 2.20.0

38

lib/parseComments.js
const fs = require('fs');
const parser = require('@babel/parser');

@@ -8,2 +9,3 @@ const TEXT = 1;

const COMMENT_NL = 4;
const ARRAY_WAIT = 5;

@@ -49,3 +51,3 @@ const propRule = /^[\r\n\t\s]*((?:class\s+|var\s+|let\s+|const\s+|async\s+|static\s+|function\s+)*)([$\w]+)(\s*[:=]\s*async\b)?/;

if (start === -1) {
slice(text);
updatePos(text);
return;

@@ -129,3 +131,9 @@ }

loc = null;
list.push(item);
if (item.value.trim().startsWith('@array ')) {
state = ARRAY_WAIT;
continue;
}
const match = text.match(propRule);

@@ -163,4 +171,2 @@

}
list.push(item);
}

@@ -178,2 +184,22 @@ else {

}
if (state === ARRAY_WAIT) {
const start = text.indexOf('[');
if (start === -1) {
updatePos(text);
return;
}
text = slice(text, start);
const end = text.indexOf(']');
if (end === -1) {
return;
}
list.at(-1).array = toArray(text.slice(0, end + 1));
text = slice(text, end + 1);
state = TEXT;
}
}

@@ -205,2 +231,8 @@ };

return match ? match[1].length : 0;
}
function toArray(code) {
const ast = parser.parseExpression(code);
return ast.elements.map(node => node.value);
}

2

package.json
{
"name": "api-doc-validator",
"version": "2.19.1",
"version": "2.20.0",
"description": "api doc and validator",

@@ -5,0 +5,0 @@ "main": "index.js",

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