@muze-nl/od-jsontag 0.3.1 → 0.3.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/parse.mjs +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muze-nl/od-jsontag",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
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>",
package/src/parse.mjs CHANGED
@@ -698,7 +698,7 @@ export default function parse(input, meta, immutable=true)
698
698
  Object.entries(parent).forEach(([key,entry]) => {
699
699
  if (Array.isArray(entry)) {
700
700
  makeChildProxies(entry)
701
- } else if (JSONTag.getType(entry)==='object') {
701
+ } else if (entry && JSONTag.getType(entry)==='object') {
702
702
  if (entry[isProxy]) {
703
703
  // do nothing
704
704
  } else {
@@ -952,7 +952,7 @@ export default function parse(input, meta, immutable=true)
952
952
  if (meta.access && !meta.access(target, prop, 'set')) {
953
953
  return undefined
954
954
  }
955
- if (JSONTag.getType(value)==='object' && !value[isProxy]) {
955
+ if (value && JSONTag.getType(value)==='object' && !value[isProxy]) {
956
956
  value = getNewValueProxy(value)
957
957
  }
958
958
  target[prop] = value
@@ -1026,6 +1026,9 @@ export default function parse(input, meta, immutable=true)
1026
1026
  }
1027
1027
 
1028
1028
  const getNewValueProxy = function(value) {
1029
+ if (value === null) {
1030
+ return null
1031
+ }
1029
1032
  let index = meta.resultArray.length
1030
1033
  meta.resultArray.push('')
1031
1034
  value[getIndex] = index