json-parser
Advanced tools
Comparing version 1.1.3 to 1.1.4
21
index.js
@@ -10,6 +10,25 @@ 'use strict'; | ||
function tokenize (code) { | ||
return esprima.tokenize(code, { | ||
var list = esprima.tokenize(code, { | ||
comment: true, | ||
loc: true | ||
}); | ||
if (list.comment) { | ||
return list; | ||
} | ||
var result = []; | ||
var comments = []; | ||
list.map(function (t) { | ||
if (t.type === 'LineComment') { | ||
t.type = 'Line'; | ||
comments.push(t); | ||
} else if (t.type === 'BlockComment') { | ||
t.type = 'Block'; | ||
comments.push(t); | ||
} else { | ||
result.push(t); | ||
} | ||
}); | ||
result.comments = comments; | ||
return result; | ||
} | ||
@@ -16,0 +35,0 @@ |
{ | ||
"name": "json-parser", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "JSON parser to parse JSON object and MAINTAIN comments.", | ||
@@ -36,4 +36,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"esprima": "~2.6.0" | ||
"esprima": "^2.7.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12186
342
+ Addedesprima@2.7.3(transitive)
- Removedesprima@2.6.0(transitive)
Updatedesprima@^2.7.0