Socket
Socket
Sign inDemoInstall

jsonext

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.4-beta to 0.0.5-beta

2

package.json
{
"name": "jsonext",
"version": "0.0.4-beta",
"version": "0.0.5-beta",
"description": "An extension of JSON that supports the next generation of ECMAScript features",

@@ -5,0 +5,0 @@ "main": "src/",

@@ -5,4 +5,3 @@ # JSONext

This pre-release version does not yet support `reviver` and only wraps
`JSON.stringify`.
This pre-release version wraps `JSON.stringify`.

@@ -9,0 +8,0 @@ ## Current features

const unicode = require('./unicode')
let text
let source
let parseState

@@ -13,4 +13,4 @@ let stack

function parse (t) {
text = String(t)
function parse (text, reviver) {
source = String(text)
parseState = 'start'

@@ -35,5 +35,25 @@ stack = []

if (typeof reviver === 'function') {
return internalize({'': root}, '', reviver)
}
return root
}
function internalize (holder, name, reviver) {
const value = holder[name]
if (value != null && typeof value === 'object') {
for (const key in value) {
const replacement = internalize(value, key, reviver)
if (replacement === undefined) {
delete value[key]
} else {
value[key] = replacement
}
}
}
return reviver.call(holder, name, value)
}
let lexState

@@ -65,4 +85,4 @@ let buffer

function peek () {
if (text[pos]) {
return String.fromCodePoint(text.codePointAt(pos))
if (source[pos]) {
return String.fromCodePoint(source.codePointAt(pos))
}

@@ -69,0 +89,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc