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.4.0 to 1.4.1

4

CHANGELOG.md

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

# v1.4.1
- fix .prettierignore
- add source trasformation example
# v1.4.0

@@ -2,0 +6,0 @@ - ESM compatibility improvements; fixes #159, #161

2

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

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

@@ -195,2 +195,42 @@ // This file is a source for playground examples.

function stringify_rename(source, parse, stringify, transforms) {
// You can do any manipulations with the parsed result
// See how each block is being mapped. If you are updating a Block.source
// then rewireSource(block) should be called on each changed block.
// If changes were made to Block.tags[].source then call rewireSpecs(block).
// This example shows how you can "rename" @param tags: value1 -> value11, value2 -> value22
/**
* Description may go
* over multiple lines followed by @tags
* @param {string} name the name parameter
* @param {any} value1 first value parameter
* with a multipline description
* @param {any} value2 second value parameter
*/
function renameParam(from, to) {
return (block) => {
for (const tag of block.tags) {
if (tag.tag === 'param' && tag.name === from) {
tag.name = to;
for (const line of tag.source) {
if (line.tokens.name === from) line.tokens.name = to;
}
}
}
return block;
};
}
const transform = transforms.flow(
renameParam('value1', 'value11'),
renameParam('value2', 'value22'),
stringify
);
const parsed = parse(source);
const stringified = parsed.map(transform);
}
(typeof window === 'undefined' ? module.exports : window).examples = [

@@ -204,2 +244,3 @@ parse_defaults,

stringify_formatting,
stringify_rename,
];
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