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 0.7.4 to 0.7.5

3

CHANGELOG.md

@@ -0,1 +1,4 @@

# v0.7.5
- name parsing fixes
# v0.7.4

@@ -2,0 +5,0 @@ - node 8 backward compatibility fixes

5

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

@@ -64,3 +64,4 @@ "main": "index.js",

"Jordan Harband (https://github.com/ljharb)",
"tengattack (https://github.com/tengattack)"
"tengattack (https://github.com/tengattack)",
"Jayden Seric (https://github.com/jaydenseric)"
],

@@ -67,0 +68,0 @@ "license": "MIT",

@@ -16,8 +16,8 @@ 'use strict'

PARSERS.parse_tag = function parse_tag (str) {
const result = str.match(/^\s*@(\S+)/)
if (!result) { throw new Error('Invalid `@tag`, missing @ symbol') }
const match = str.match(/^\s*@(\S+)/)
if (!match) { throw new SyntaxError('Invalid `@tag`, missing @ symbol') }
return {
source: result[0],
data: { tag: result[1] }
source: match[0],
data: { tag: match[1] }
}

@@ -42,3 +42,3 @@ }

if (curlies !== 0) { throw new Error('Invalid `{type}`, unpaired curlies') }
if (curlies !== 0) { throw new SyntaxError('Invalid `{type}`, unpaired curlies') }

@@ -73,3 +73,3 @@ return {

if (brackets !== 0) { throw new Error('Invalid `name`, unpaired brackets') }
if (brackets !== 0) { throw new SyntaxError('Invalid `name`, unpaired brackets') }

@@ -82,7 +82,10 @@ res = { name, optional: false }

if (name.indexOf('=') !== -1) {
const parts = name.split('=')
name = parts[0]
res.default = parts[1].replace(/^(["'])(.+)(\1)$/, '$2')
}
const match = name.match(
/^\s*([^=]+?)(?:\s*=\s*(.+?))?\s*(?=$)/
)
if (!match) throw new SyntaxError('Invalid `name`, bad syntax')
name = match[1]
if (match[2]) res.default = match[2]
}

@@ -102,8 +105,8 @@ }

const result = str.match(/^\s+((.|\s)+)?/)
const match = str.match(/^\s+((.|\s)+)?/)
if (result) {
if (match) {
return {
source: result[0],
data: { description: result[1] === undefined ? '' : result[1] }
source: match[0],
data: { description: match[1] === undefined ? '' : match[1] }
}

@@ -110,0 +113,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