zkjson 0.1.5 → 0.1.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.
Files changed (2) hide show
  1. package/encoder.js +4 -0
  2. package/package.json +1 -1
package/encoder.js CHANGED
@@ -295,6 +295,8 @@ function encodeVal(v) {
295
295
  vals = [0]
296
296
  } else if (typeof v === "string") {
297
297
  vals = [3, v.length, ...v.split("").map(c => c.charCodeAt(0))]
298
+ } else {
299
+ vals = [4, ...encode(v)]
298
300
  }
299
301
  return vals
300
302
  }
@@ -317,6 +319,8 @@ function decodeVal(arr) {
317
319
  .slice(2)
318
320
  .map(c => String.fromCharCode(c))
319
321
  .join("")
322
+ } else if (type === 4) {
323
+ val = decode(arr.slice(1))
320
324
  }
321
325
  return val
322
326
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zkjson",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Zero Knowledge Provable JSON",
5
5
  "main": "index.js",
6
6
  "license": "MIT",