Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swagger-jsdoc

Package Overview
Dependencies
Maintainers
3
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-jsdoc - npm Package Compare versions

Comparing version 4.2.3 to 4.3.0

1

lib/helpers/parseApiFile.js
const fs = require('fs');
const path = require('path');
const parseApiFileContent = require('./parseApiFileContent');
/**

@@ -5,0 +6,0 @@ * Parses the provided API file for JSDoc comments.

40

lib/helpers/parseApiFileContent.js

@@ -15,14 +15,34 @@ const doctrine = require('doctrine');

const jsDocRegex = /\/\*\*([\s\S]*?)\*\//gm;
const csDocRegex = /###([\s\S]*?)###/gm;
const yaml = [];
const jsDocComments = [];
const jsdoc = [];
let regexResults = null;
if (ext === '.yaml' || ext === '.yml') {
yaml.push(jsYaml.safeLoad(fileContent));
} else {
const regexResults = fileContent.match(jsDocRegex);
if (regexResults) {
for (let i = 0; i < regexResults.length; i += 1) {
const jsDocComment = doctrine.parse(regexResults[i], { unwrap: true });
jsDocComments.push(jsDocComment);
switch (ext) {
case '.yml':
case '.yaml':
yaml.push(jsYaml.safeLoad(fileContent));
break;
case '.coffee':
regexResults = fileContent.match(csDocRegex);
if (regexResults) {
for (let i = 0; i < regexResults.length; i += 1) {
// Prepare input for doctrine
let part = regexResults[i].split('###');
part[0] = `/**`;
part[regexResults.length - 1] = '*/';
part = part.join('');
jsdoc.push(doctrine.parse(part, { unwrap: true }));
}
}
break;
default: {
regexResults = fileContent.match(jsDocRegex);
if (regexResults) {
for (let i = 0; i < regexResults.length; i += 1) {
jsdoc.push(doctrine.parse(regexResults[i], { unwrap: true }));
}
}
}

@@ -33,3 +53,3 @@ }

yaml,
jsdoc: jsDocComments,
jsdoc,
};

@@ -36,0 +56,0 @@ }

{
"name": "swagger-jsdoc",
"version": "4.2.3",
"version": "4.3.0",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=10.0.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