@muze-nl/od-jsontag 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/parse.mjs +13 -10
- package/src/symbols.mjs +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muze-nl/od-jsontag",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "On Demand JSONTag: parse/serialize large datastructures on demand, useful for sharing data between threads",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Auke van Slooten <auke@muze.nl>",
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
"LICENSE"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@muze-nl/jsontag": "^0.9.
|
|
37
|
+
"@muze-nl/jsontag": "^0.9.11"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/src/parse.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import JSONTag from '@muze-nl/jsontag';
|
|
2
2
|
import Null from '@muze-nl/jsontag/src/lib/Null.mjs'
|
|
3
3
|
import serialize from './serialize.mjs'
|
|
4
|
-
import {source,isProxy,proxyType,getBuffer,getIndex,isChanged,isParsed,position,parent,resultSet} from './symbols.mjs'
|
|
4
|
+
import {source,isProxy,proxyType,getBuffer,getIndex,isChanged,isParsed,isReceived,position,parent,resultSet} from './symbols.mjs'
|
|
5
5
|
|
|
6
6
|
const decoder = new TextDecoder()
|
|
7
7
|
const encoder = new TextEncoder()
|
|
@@ -1018,16 +1018,19 @@ export default function parse(input, meta, immutable=true)
|
|
|
1018
1018
|
if (!target[isParsed]) {
|
|
1019
1019
|
parseValue(target[position], target)
|
|
1020
1020
|
target[isParsed] = true
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1021
|
+
}
|
|
1022
|
+
if (receiver && !target[isReceived]) {
|
|
1023
|
+
//FIXME: this breaks on a Proxy without receiver param
|
|
1024
|
+
//e.g. odJSONTag and a call to ownKeys triggering the first parse
|
|
1025
|
+
let tag = JSONTag.getType(target)
|
|
1026
|
+
if (tag) {
|
|
1027
|
+
JSONTag.setType(receiver, tag)
|
|
1028
|
+
}
|
|
1029
|
+
let attributes = JSONTag.getAttributes(target)
|
|
1030
|
+
if (attributes) {
|
|
1031
|
+
JSONTag.setAttributes(receiver, attributes)
|
|
1030
1032
|
}
|
|
1033
|
+
target[isReceived] = true
|
|
1031
1034
|
}
|
|
1032
1035
|
}
|
|
1033
1036
|
|
package/src/symbols.mjs
CHANGED
|
@@ -5,6 +5,7 @@ export const getBuffer = Symbol('getBuffer')
|
|
|
5
5
|
export const getIndex = Symbol('getIndex')
|
|
6
6
|
export const isChanged = Symbol('isChanged')
|
|
7
7
|
export const isParsed = Symbol('isParsed')
|
|
8
|
+
export const isReceived = Symbol('isReceived')
|
|
8
9
|
export const getString = Symbol('getString')
|
|
9
10
|
export const position = Symbol('position')
|
|
10
11
|
export const parent = Symbol('parent')
|