diff --git a/README.md b/README.md index e79c565..1252e03 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ All input to `JSON.parse` that is currently rejected will continue to be, all in ### Modified values Reviver functions are intended to modify or remove values in the output, but those changes should have no effect on the source-derived arguments passed to them. Because reviver functions are invoked bottom-up, this means that values may not correlate with source text. -We consider this to be acceptable, but moot (see the following point). +We consider this to be acceptable, but mostly moot (see the following point). Where _not_ moot (such as when not-yet-visited array indexes or object entries are modified), source text is suppressed. ### Non-primitive values Per https://github.com/tc39/proposal-json-parse-with-source/issues/10#issuecomment-704441802 , source text exposure is limited to primitive values. diff --git a/spec.html b/spec.html index 15893e1..1fbc6db 100644 --- a/spec.html +++ b/spec.html @@ -48,7 +48,7 @@
This function parses a JSON text (a JSON-formatted String) and produces an ECMAScript language value. The JSON format represents literals, arrays, and objects with a syntax similar to the syntax for ECMAScript literals, Array Initializers, and Object Initializers. After parsing, JSON objects are realized as ECMAScript objects. JSON arrays are realized as ECMAScript Array instances. JSON strings, numbers, booleans, and null are realized as ECMAScript Strings, Numbers, Booleans, and *null*.
-The optional _reviver_ parameter is a function that takes two parameters, _key_ and _value_. It can filter and transform the results. It is called with each of the _key_/_value_ pairs produced by the parse,For each value produced by the parse, it is called with three arguments (the key, the value, and a context object containing [for primitive values] details of the corresponding Parse Node) and its return value is used instead of the original value. If it returns what it received, the structure is not modified. If it returns *undefined* then the property is deleted from the result.
The optional _reviver_ parameter is a function that takes two parameters, _key_ and _value_. It can filter and transform the results. It is called with each of the _key_/_value_ pairs produced by the parse,For each value produced by the parse, it is called with three arguments (the key, the value, and a context object containing [for unmodified primitive values] details of the corresponding Parse Node) and its return value is used instead of the original value. If it returns what it received, the structure is not modified. If it returns *undefined* then the property is deleted from the result.
However, because
A JSON Parse Record is a Record value used to describe the initial state of a value parsed from JSON text.
+JSON Parse Records have the fields listed in
Field Name | +Value | +Meaning | +
---|---|---|
[[ParseNode]] | +a Parse Node | +The context Parse Node. | +
[[Key]] | +a property name | +The property name with which [[Value]] is associated. | +
[[Value]] | +an ECMAScript language value | +The value produced by evaluation of [[ParseNode]]. | +
[[Elements]] | +a List of JSON Parse Records | +JSON Parse Records corresponding with the elements of a [[Value]] that is an Array, in order. If [[Value]] is not an Array, the List will be empty. | +
[[Entries]] | +a List of JSON Parse Records | +JSON Parse Records corresponding with the entries of a [[Value]] that is a non-Array Object, in source order. If [[Value]] is not a non-Array Object, the List will be empty. | +
{"a":"lost","a":"kept"}
), the value for the corresponding property of the resulting ECMAScript object is specified by the last pair with that name.
+ 1. Assert: _propertyDefinition_ is It performs the following steps when called:
{"a":"lost","a":"kept"}
), the value for the corresponding property of the resulting ECMAScript object is specified by the last pair with that name.
- 1. Assert: _propertyDefinition_ is