Closed gibson042 closed 1 year ago
Source text access is restricted to primitive values per https://github.com/tc39/proposal-json-parse-with-source/issues/10#issuecomment-704441802 , so there is currently no information to provide for non-primitive values:
JSON.parse("42", (key, val, context) => context) // => {source: "42"} JSON.parse("{}", (key, val, context) => context) // => ???
Some possibilities:
undefined
source
{}
source: undefined
I am in favor of the third option, always providing the object for consistency (and in particular to not break callbacks that attempt to destructure it) but omitting the source property.
Source text access is restricted to primitive values per https://github.com/tc39/proposal-json-parse-with-source/issues/10#issuecomment-704441802 , so there is currently no information to provide for non-primitive values:
Some possibilities:
undefined
.source
property ({}
).source: undefined
.