Comparing version 0.0.2-beta to 0.0.3-beta
{ | ||
"name": "jsonext", | ||
"version": "0.0.2-beta", | ||
"version": "0.0.3-beta", | ||
"description": "An extension of JSON that supports the next generation of ECMAScript features", | ||
@@ -10,3 +10,3 @@ "main": "src/", | ||
"scripts": { | ||
"lint": "eslint . --fix", | ||
"lint": "eslint src/ --fix", | ||
"test": "nyc --reporter=html --reporter=text mocha" | ||
@@ -13,0 +13,0 @@ }, |
# JSONext | ||
This pre-release version supports JSON5 syntax but does not yet support | ||
`reviver` and only wraps `JSON.stringify`. | ||
This pre-release version supports JSON5 syntax plus ES6 templates but does not | ||
yet support `reviver` and only wraps `JSON.stringify`. |
@@ -103,2 +103,5 @@ let text | ||
return | ||
case undefined: | ||
return newToken('eof') | ||
} | ||
@@ -135,4 +138,9 @@ | ||
multiLineComment () { | ||
if (c === '*') { | ||
switch (c) { | ||
case '*': | ||
lexState = 'multiLineCommentAsterisk' | ||
break | ||
case undefined: | ||
throw invalidChar(c) | ||
} | ||
@@ -144,2 +152,6 @@ | ||
multiLineCommentAsterisk () { | ||
if (c === undefined) { | ||
throw invalidChar(c) | ||
} | ||
read() | ||
@@ -157,2 +169,5 @@ lexState = (c === '/') ? 'default' : 'multiLineComment' | ||
break | ||
case undefined: | ||
return newToken('eof') | ||
} | ||
@@ -231,4 +246,11 @@ | ||
doubleQuote = (read() === '"') | ||
buffer = '' | ||
lexState = 'string' | ||
return | ||
case '`': | ||
read() | ||
buffer = '' | ||
lexState = 'template' | ||
return | ||
} | ||
@@ -598,2 +620,5 @@ | ||
break | ||
case undefined: | ||
throw invalidChar() | ||
} | ||
@@ -605,2 +630,47 @@ | ||
template () { | ||
switch (c) { | ||
case '$': | ||
buffer += read() | ||
lexState = 'templateDollar' | ||
return | ||
case '\\': | ||
read() | ||
buffer += escape() | ||
return | ||
case '\r': | ||
read() | ||
if (peek() === '\n') { | ||
read() | ||
} | ||
buffer += '\n' | ||
return | ||
case '`': | ||
read() | ||
return newToken('string', buffer) | ||
case undefined: | ||
throw invalidChar() | ||
} | ||
buffer += read() | ||
return | ||
}, | ||
templateDollar () { | ||
switch (c) { | ||
case '{': | ||
case undefined: | ||
throw invalidChar(c) | ||
} | ||
buffer += read() | ||
lexState = 'template' | ||
return | ||
}, | ||
start () { | ||
@@ -793,2 +863,5 @@ switch (c) { | ||
return '\n' | ||
case undefined: | ||
throw invalidChar(c) | ||
} | ||
@@ -1037,2 +1110,6 @@ | ||
function invalidChar (c) { | ||
if (c === undefined) { | ||
return new SyntaxError(`JSONext: invalid end of input at ${line}:${column}`) | ||
} | ||
return new SyntaxError(`JSONext: invalid character '${c}' at ${line}:${column}`) | ||
@@ -1042,2 +1119,6 @@ } | ||
function invalidToken () { | ||
if (token.type === 'eof') { | ||
return new SyntaxError(`JSONext: invalid end of input at ${line}:${column}`) | ||
} | ||
const c = String.fromCodePoint(token.value.codePointAt(0)) | ||
@@ -1044,0 +1125,0 @@ return new SyntaxError(`JSONext: invalid character '${c}' at ${line}:${column}`) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17900
918
0