zkjson 0.1.4 → 0.1.5
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/encoder.js +10 -3
- package/package.json +1 -1
package/encoder.js
CHANGED
@@ -385,9 +385,12 @@ const str2id = str => {
|
|
385
385
|
}
|
386
386
|
|
387
387
|
const id2str = id => {
|
388
|
-
id.
|
389
|
-
|
390
|
-
|
388
|
+
let _id = id.toString().split("")
|
389
|
+
_id.shift()
|
390
|
+
return splitEvery(2, _id)
|
391
|
+
.map(s => {
|
392
|
+
return strMap[s.join("")]
|
393
|
+
})
|
391
394
|
.join("")
|
392
395
|
}
|
393
396
|
|
@@ -443,6 +446,8 @@ function str2val(arr) {
|
|
443
446
|
|
444
447
|
const toSignal = val2str
|
445
448
|
const fromSignal = str2val
|
449
|
+
const toIndex = str2id
|
450
|
+
const fromIndex = id2str
|
446
451
|
|
447
452
|
module.exports = {
|
448
453
|
encode,
|
@@ -460,4 +465,6 @@ module.exports = {
|
|
460
465
|
id2str,
|
461
466
|
toSignal,
|
462
467
|
fromSignal,
|
468
|
+
toIndex,
|
469
|
+
fromIndex,
|
463
470
|
}
|