@nakanoaas/uuid58 1.0.0 → 1.0.1
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/esm/decode.js +2 -2
- package/package.json +1 -1
- package/script/decode.js +2 -2
package/esm/decode.js
CHANGED
|
@@ -33,7 +33,7 @@ _a = Uuid58DecodeError;
|
|
|
33
33
|
*/
|
|
34
34
|
export function uuid58DecodeSafe(uuid58) {
|
|
35
35
|
if (uuid58.length !== 22) {
|
|
36
|
-
return new Uuid58DecodeError(`Base58 string
|
|
36
|
+
return new Uuid58DecodeError(`Expected Base58 string of length 22, but received string of length ${uuid58.length}: ${uuid58}`);
|
|
37
37
|
}
|
|
38
38
|
let num = 0n;
|
|
39
39
|
for (const char of uuid58) {
|
|
@@ -45,7 +45,7 @@ export function uuid58DecodeSafe(uuid58) {
|
|
|
45
45
|
}
|
|
46
46
|
const hex = num.toString(16).padStart(32, "0");
|
|
47
47
|
if (hex.length !== 32) {
|
|
48
|
-
return new Uuid58DecodeError(`Decoded
|
|
48
|
+
return new Uuid58DecodeError(`Decoded value exceeds 128 bits of UUID: ${uuid58}`);
|
|
49
49
|
}
|
|
50
50
|
return (hex.slice(0, 8) +
|
|
51
51
|
"-" +
|
package/package.json
CHANGED
package/script/decode.js
CHANGED
|
@@ -39,7 +39,7 @@ _a = Uuid58DecodeError;
|
|
|
39
39
|
*/
|
|
40
40
|
function uuid58DecodeSafe(uuid58) {
|
|
41
41
|
if (uuid58.length !== 22) {
|
|
42
|
-
return new Uuid58DecodeError(`Base58 string
|
|
42
|
+
return new Uuid58DecodeError(`Expected Base58 string of length 22, but received string of length ${uuid58.length}: ${uuid58}`);
|
|
43
43
|
}
|
|
44
44
|
let num = 0n;
|
|
45
45
|
for (const char of uuid58) {
|
|
@@ -51,7 +51,7 @@ function uuid58DecodeSafe(uuid58) {
|
|
|
51
51
|
}
|
|
52
52
|
const hex = num.toString(16).padStart(32, "0");
|
|
53
53
|
if (hex.length !== 32) {
|
|
54
|
-
return new Uuid58DecodeError(`Decoded
|
|
54
|
+
return new Uuid58DecodeError(`Decoded value exceeds 128 bits of UUID: ${uuid58}`);
|
|
55
55
|
}
|
|
56
56
|
return (hex.slice(0, 8) +
|
|
57
57
|
"-" +
|