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

comment-json

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-json - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

15

package.json
{
"name": "comment-json",
"version": "3.0.2",
"version": "3.0.3",
"description": "Parse and stringify JSON with comments. It will retain comments even after saved!",

@@ -42,3 +42,2 @@ "main": "src/index.js",

"ava": {
"babel": false,
"files": [

@@ -55,9 +54,9 @@ "test/*.test.js"

"@ostai/eslint-config": "^3.5.0",
"ava": "^2.4.0",
"codecov": "^3.6.1",
"eslint": "^6.6.0",
"eslint-plugin-import": "^2.18.2",
"nyc": "^14.1.1",
"ava": "^3.8.2",
"codecov": "^3.7.0",
"eslint": "^7.1.0",
"eslint-plugin-import": "^2.20.2",
"nyc": "^15.0.1",
"test-fixture": "^2.4.1",
"typescript": "^3.7.4"
"typescript": "^3.9.3"
},

@@ -64,0 +63,0 @@ "dependencies": {

@@ -64,3 +64,3 @@ const {

? c
: `\\u${(`0000${a.charCodeAt(0).toString(16)}`).slice(- 4)}`
: a
})

@@ -200,6 +200,2 @@ }

const colon_value_gap = indent
? SPACE
: EMPTY
// From the first element to before close

@@ -242,3 +238,3 @@ let inside = EMPTY

+ process_comments(value, AFTER_COLON(key), deeper_gap)
+ colon_value_gap
+ SPACE
+ sv

@@ -323,2 +319,18 @@ + process_comments(value, AFTER_VALUE(key), deeper_gap)

const {toString} = Object.prototype
const PRIMITIVE_OBJECT_TYPES = [
'[object Number]',
'[object String]',
'[object Boolean]'
]
const is_primitive_object = subject => {
if (typeof subject !== 'object') {
return false
}
const str = toString.call(subject)
return PRIMITIVE_OBJECT_TYPES.includes(str)
}
// @param {function()|Array} replacer

@@ -341,4 +353,2 @@ // @param {string|number} space

// ~~If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.~~
// vanilla `JSON.parse` allow invalid replacer

@@ -352,3 +362,5 @@ if (!isFunction(replacer_) && !isArray(replacer_)) {

const str = stringify('', {'': value}, EMPTY)
const str = is_primitive_object(value)
? JSON.stringify(value)
: stringify('', {'': value}, EMPTY)

@@ -355,0 +367,0 @@ clean()

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