@ocap/util 1.16.4 → 1.16.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/lib/index.js +6 -6
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -553,17 +553,17 @@ function isUUID(str) {
|
|
|
553
553
|
function toUint8Array(v) {
|
|
554
554
|
let vb = null;
|
|
555
555
|
if ([null, undefined, ''].includes(v)) {
|
|
556
|
-
vb = Uint8Array
|
|
556
|
+
vb = new Uint8Array();
|
|
557
557
|
} else if (Buffer.isBuffer(v)) {
|
|
558
|
-
vb = Uint8Array
|
|
558
|
+
vb = new Uint8Array(v);
|
|
559
559
|
} else if (isHexStrict(v)) {
|
|
560
|
-
vb = Uint8Array
|
|
560
|
+
vb = new Uint8Array(hexToBytes(v));
|
|
561
561
|
} else if (isUint8Array(v)) {
|
|
562
|
-
vb = Uint8Array
|
|
562
|
+
vb = new Uint8Array(v);
|
|
563
563
|
} else if (multibase.isEncoded(v) === 'base58btc') {
|
|
564
|
-
vb = Uint8Array
|
|
564
|
+
vb = new Uint8Array(multibase.decode(v));
|
|
565
565
|
} else if (typeof v === 'string') {
|
|
566
|
-
vb = Uint8Array
|
|
566
|
+
vb = new Uint8Array(hexToBytes(toHex(v)));
|
|
567
567
|
} else {
|
|
568
568
|
throw new Error(
|
|
569
569
|
`Unsupported input type ${typeof v} detected for toBuffer, only Uint8Array/Buffer/Hex/Base58 are supported`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocap/util",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.5",
|
|
4
4
|
"description": "utils shared across multiple forge js libs, works in both node.js and browser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"forge",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"bugs": {
|
|
57
57
|
"url": "https://github.com/ArcBlock/asset-chain/issues"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "689afc27e0aa3d712fa47449dddea0e2d1a81e1a"
|
|
60
60
|
}
|