jsonext
Advanced tools
Comparing version 0.0.5-beta to 0.0.6-beta
{ | ||
"name": "jsonext", | ||
"version": "0.0.5-beta", | ||
"version": "0.0.6-beta", | ||
"description": "An extension of JSON that supports the next generation of ECMAScript features", | ||
@@ -5,0 +5,0 @@ "main": "src/", |
@@ -5,4 +5,2 @@ # JSONext | ||
This pre-release version wraps `JSON.stringify`. | ||
## Current features | ||
@@ -9,0 +7,0 @@ |
const Parser = require('./parser') | ||
const Stringifier = require('./stringifier') | ||
const JSONext = { | ||
parse: Parser.parse, | ||
stringify: JSON.stringify, | ||
stringify: Stringifier.stringify, | ||
} | ||
module.exports = JSONext |
@@ -1,2 +0,2 @@ | ||
const unicode = require('./unicode') | ||
const util = require('./util') | ||
@@ -130,3 +130,3 @@ let source | ||
if (isSpaceSeparator(c)) { | ||
if (util.isSpaceSeparator(c)) { | ||
read() | ||
@@ -292,3 +292,3 @@ return | ||
default: | ||
if (!isIdStartChar(u)) { | ||
if (!util.isIdStartChar(u)) { | ||
throw invalidIdentifier() | ||
@@ -320,3 +320,3 @@ } | ||
if (isIdContinueChar(c)) { | ||
if (util.isIdContinueChar(c)) { | ||
buffer += read() | ||
@@ -344,3 +344,3 @@ return | ||
default: | ||
if (!isIdContinueChar(u)) { | ||
if (!util.isIdContinueChar(u)) { | ||
throw invalidIdentifier() | ||
@@ -441,3 +441,3 @@ } | ||
if (isDigit(c)) { | ||
if (util.isDigit(c)) { | ||
buffer += read() | ||
@@ -451,3 +451,3 @@ return | ||
decimalPointLeading () { | ||
if (isDigit(c)) { | ||
if (util.isDigit(c)) { | ||
buffer += read() | ||
@@ -470,3 +470,3 @@ lexState = 'decimalFraction' | ||
if (isDigit(c)) { | ||
if (util.isDigit(c)) { | ||
buffer += read() | ||
@@ -489,3 +489,3 @@ lexState = 'decimalFraction' | ||
if (isDigit(c)) { | ||
if (util.isDigit(c)) { | ||
buffer += read() | ||
@@ -507,3 +507,3 @@ return | ||
if (isDigit(c)) { | ||
if (util.isDigit(c)) { | ||
buffer += read() | ||
@@ -518,3 +518,3 @@ lexState = 'decimalExponentInteger' | ||
decimalExponentSign () { | ||
if (isDigit(c)) { | ||
if (util.isDigit(c)) { | ||
buffer += read() | ||
@@ -529,3 +529,3 @@ lexState = 'decimalExponentInteger' | ||
decimalExponentInteger () { | ||
if (isDigit(c)) { | ||
if (util.isDigit(c)) { | ||
buffer += read() | ||
@@ -597,3 +597,3 @@ return | ||
hexadecimal () { | ||
if (isHexDigit(c)) { | ||
if (util.isHexDigit(c)) { | ||
buffer += read() | ||
@@ -608,3 +608,3 @@ lexState = 'hexadecimalInteger' | ||
hexadecimalInteger () { | ||
if (isHexDigit(c)) { | ||
if (util.isHexDigit(c)) { | ||
buffer += read() | ||
@@ -740,3 +740,3 @@ return | ||
if (isIdStartChar(c)) { | ||
if (util.isIdStartChar(c)) { | ||
buffer += read() | ||
@@ -800,27 +800,2 @@ lexState = 'identifierName' | ||
function isSpaceSeparator (c) { | ||
return unicode.Space_Separator.test(c) | ||
} | ||
function isIdStartChar (c) { | ||
return (c >= 'a' && c <= 'z') || | ||
(c >= 'A' && c <= 'Z') || | ||
unicode.ID_Start.test(c) | ||
} | ||
function isIdContinueChar (c) { | ||
return (c >= 'a' && c <= 'z') || | ||
(c >= 'A' && c <= 'Z') || | ||
(c >= '0' && c <= '9') || | ||
unicode.ID_Continue.test(c) | ||
} | ||
function isDigit (c) { | ||
return /[0-9]/.test(c) | ||
} | ||
function isHexDigit (c) { | ||
return /[0-9A-Fa-f]/.test(c) | ||
} | ||
function newToken (type, value) { | ||
@@ -911,3 +886,3 @@ return { | ||
if (!isHexDigit(c)) { | ||
if (!util.isHexDigit(c)) { | ||
throw invalidChar(c) | ||
@@ -919,3 +894,3 @@ } | ||
c = peek() | ||
if (!isHexDigit(c)) { | ||
if (!util.isHexDigit(c)) { | ||
throw invalidChar(c) | ||
@@ -945,3 +920,3 @@ } | ||
const c = peek() | ||
if (!isHexDigit(c)) { | ||
if (!util.isHexDigit(c)) { | ||
throw invalidChar(c) | ||
@@ -960,3 +935,3 @@ } | ||
let c = peek() | ||
if (!isHexDigit(c)) { | ||
if (!util.isHexDigit(c)) { | ||
throw invalidChar(c) | ||
@@ -967,3 +942,3 @@ } | ||
while (isHexDigit(c = peek())) { | ||
while (util.isHexDigit(c = peek())) { | ||
buffer += read() | ||
@@ -970,0 +945,0 @@ } |
40146
8
1215
62