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

comment-parser

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

comment-parser - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

15

browser/index.js

@@ -22,2 +22,5 @@ var CommentParser = (function (exports) {

}
function seedBlock(block = {}) {
return Object.assign({ description: '', tags: [], source: [], problems: [] }, block);
}
function seedSpec(spec = {}) {

@@ -41,2 +44,12 @@ return Object.assign({ tag: '', name: '', type: '', optional: false, description: '', problems: [], source: [] }, spec);

}
/**
* Assures Block.source contains references to the Block.tags[].source items,
* using Block.tags[].source as a source of truth. This is a counterpart of rewireSource
* @param block parsed coments block
*/
function rewireSpecs(block) {
const source = block.tags.reduce((acc, spec) => spec.source.reduce((acc, line) => acc.set(line.number, line), acc), new Map());
block.source = block.source.map((line) => source.get(line.number) || line);
return block;
}

@@ -627,2 +640,3 @@ const reTag = /^@\S+/;

};
const util = { rewireSpecs, rewireSource, seedBlock, seedTokens };

@@ -634,2 +648,3 @@ exports.inspect = inspect;

exports.transforms = transforms;
exports.util = util;

@@ -636,0 +651,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# v1.2.2
- re-export ./util on the top-level for compatibility with older Node
- point package's main to .cjs file
# v1.2.1

@@ -2,0 +6,0 @@ - bump `engines` per `exports` issues in earlier Node versions

@@ -10,2 +10,3 @@ import { Options as ParserOptions } from './parser/index';

import { flow as flowTransform } from './transforms/index';
import { rewireSpecs, rewireSource, seedBlock, seedTokens } from './util';
export * from './primitives';

@@ -27,1 +28,7 @@ export declare function parse(source: string, options?: Partial<ParserOptions>): import("./primitives").Block[];

};
export declare const util: {
rewireSpecs: typeof rewireSpecs;
rewireSource: typeof rewireSource;
seedBlock: typeof seedBlock;
seedTokens: typeof seedTokens;
};

@@ -11,2 +11,3 @@ import getParser from './parser/index.js';

import { flow as flowTransform } from './transforms/index.js';
import { rewireSpecs, rewireSource, seedBlock, seedTokens } from './util.js';
export * from './primitives.js';

@@ -30,1 +31,2 @@ export function parse(source, options = {}) {

};
export const util = { rewireSpecs, rewireSource, seedBlock, seedTokens };

@@ -10,2 +10,3 @@ import { Options as ParserOptions } from './parser/index';

import { flow as flowTransform } from './transforms/index';
import { rewireSpecs, rewireSource, seedBlock, seedTokens } from './util';
export * from './primitives';

@@ -27,1 +28,7 @@ export declare function parse(source: string, options?: Partial<ParserOptions>): import("./primitives").Block[];

};
export declare const util: {
rewireSpecs: typeof rewireSpecs;
rewireSource: typeof rewireSource;
seedBlock: typeof seedBlock;
seedTokens: typeof seedTokens;
};

2

package.json
{
"name": "comment-parser",
"version": "1.2.1",
"version": "1.2.2",
"description": "Generic JSDoc-like comment parser",

@@ -5,0 +5,0 @@ "type": "module",

@@ -11,2 +11,3 @@ import getParser, { Options as ParserOptions } from './parser/index';

import { flow as flowTransform } from './transforms/index';
import { rewireSpecs, rewireSource, seedBlock, seedTokens } from './util';

@@ -35,1 +36,3 @@ export * from './primitives';

};
export const util = { rewireSpecs, rewireSource, seedBlock, seedTokens };

Sorry, the diff of this file is not supported yet

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