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

express-jsdoc-swagger

Package Overview
Dependencies
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-jsdoc-swagger - npm Package Compare versions

Comparing version 1.1.3 to 1.2.0

44

consumers/globFilesMatches.js

@@ -5,16 +5,44 @@ const glob = require('glob');

const DEFAULT_EXCLUDED_FOLDER = 'node_modules';
const DEFAULT_GLOB_OPTIONS = { ignore: '**/node_modules/**' };
const globFilesMatches = (baseDir, filePath, excludedFolder = DEFAULT_EXCLUDED_FOLDER) => (
const globFilesMatches = (baseDir, filesPattern, excludedFolder = DEFAULT_EXCLUDED_FOLDER) => (
new Promise((resolve, reject) => {
if (!baseDir || !filePath) {
if (!baseDir || !filesPattern) {
const error = new Error('baseDir and filePath are required');
return reject(error);
}
return glob(path.resolve(baseDir, filePath), { ignore: '**/node_modules/**' }, (err, files) => {
if (err) {
return reject(err);
if (!Array.isArray(filesPattern) && typeof filesPattern !== 'string') {
const error = new Error('files pattern has to be a type of string');
return reject(error);
}
if (Array.isArray(filesPattern)) {
if (filesPattern.length === 0) {
const error = new Error('if you submit an array of filesPattern it must contain at least one pattern');
return reject(error);
}
const filterFiles = files.filter(file => !file.includes(excludedFolder));
return resolve(filterFiles);
});
if (filesPattern.some(pattern => typeof pattern !== 'string')) {
const error = new Error('all file patterns have to be strings');
return reject(error);
}
}
try {
let files;
if (!Array.isArray(filesPattern)) {
files = glob.sync(path.resolve(baseDir, filesPattern), DEFAULT_GLOB_OPTIONS);
} else {
files = filesPattern
.map(pattern => glob.sync(path.resolve(baseDir, pattern), DEFAULT_EXCLUDED_FOLDER))
.reduce((memo, it) => memo.concat(it), [])
.filter((value, index, self) => self.indexOf(value) === index);
}
const filteredFiles = files.filter(file => !file.includes(excludedFolder));
return resolve(filteredFiles);
} catch (error) {
return reject(error);
}
})

@@ -21,0 +49,0 @@ );

2

index.d.ts

@@ -38,3 +38,3 @@ // Type definitions for express-jsdoc-swagger

baseDir: string;
filesPattern: string;
filesPattern: string | string[];
security?: SecurityObject[];

@@ -41,0 +41,0 @@ servers?: string[];

{
"name": "express-jsdoc-swagger",
"version": "1.1.3",
"version": "1.2.0",
"description": "Swagger OpenAPI 3.x generator",

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

@@ -42,3 +42,3 @@ ![npm](https://img.shields.io/npm/v/express-jsdoc-swagger)

},
filesPattern: './**/*.js', // Glob pattern to find your jsdoc files
filesPattern: './**/*.js', // Glob pattern to find your jsdoc files (it supports arrays too ['./**/*.controller.js', './**/*.route.js'])
swaggerUIPath: '/your-url', // SwaggerUI will be render in this url. Default: '/api-docs'

@@ -170,2 +170,3 @@ baseDir: __dirname,

<td align="center"><a href="https://github.com/thuydx55"><img src="https://avatars2.githubusercontent.com/u/1469984?v=4" width="100px;" alt=""/><br /><sub><b>Nick Dong</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=thuydx55" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/Stosiu"><img src="https://avatars1.githubusercontent.com/u/10252063?v=4" width="100px;" alt=""/><br /><sub><b>Aleksander Stós</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=Stosiu" title="Code">💻</a></td>
</tr>

@@ -172,0 +173,0 @@ </table>

Sorry, the diff of this file is not supported yet

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