@muze-nl/od-jsontag 0.2.5 → 0.2.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muze-nl/od-jsontag",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
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/serialize.mjs CHANGED
@@ -28,7 +28,7 @@ export default function serialize(value, options={}) {
28
28
  }
29
29
  }
30
30
 
31
- function stringifyValue(value, inarray=false) {
31
+ function stringifyValue(value, inarray=false, current) {
32
32
  let prop
33
33
  let typeString = odJSONTag.getTypeString(value)
34
34
  let type = odJSONTag.getType(value)
@@ -80,7 +80,7 @@ export default function serialize(value, options={}) {
80
80
  prop = typeString + value
81
81
  break
82
82
  case 'array':
83
- let entries = value.map(e => stringifyValue(e, true)).join(',')
83
+ let entries = value.map(e => stringifyValue(e, true, current)).join(',')
84
84
  prop = typeString + '[' + entries + ']'
85
85
  break
86
86
  case 'object':
@@ -127,7 +127,7 @@ export default function serialize(value, options={}) {
127
127
  let props = []
128
128
  for (let key of Object.getOwnPropertyNames(object)) {
129
129
  let value = object[key]
130
- let prop = stringifyValue(value)
130
+ let prop = stringifyValue(value, false, current)
131
131
  let enumerable = object.propertyIsEnumerable(key) ? '' : '#'
132
132
  props.push(enumerable+'"'+key+'":'+prop)
133
133
  }