@nakanoaas/uuid58 0.0.6 → 0.0.7
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.d.ts.map +1 -1
- package/esm/decode.js +2 -2
- package/esm/encode.d.ts.map +1 -1
- package/esm/encode.js +2 -2
- package/package.json +1 -1
- package/script/decode.d.ts.map +1 -1
- package/script/decode.js +2 -2
- package/script/encode.d.ts.map +1 -1
- package/script/encode.js +2 -2
package/esm/decode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../src/decode.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;CAI3C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CA4B3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../src/decode.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;CAI3C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CA4B3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA4BnD"}
|
package/esm/decode.js
CHANGED
|
@@ -71,13 +71,13 @@ export function uuid58Decode(base58) {
|
|
|
71
71
|
for (const char of base58) {
|
|
72
72
|
const index = BASE58_MAP[char];
|
|
73
73
|
if (index === undefined) {
|
|
74
|
-
throw new Uuid58DecodeError(base58);
|
|
74
|
+
throw new Uuid58DecodeError(`Character '${char}' is not a valid Base58 character in string: ${base58}`);
|
|
75
75
|
}
|
|
76
76
|
num = num * ALPHABET_LENGTH + index;
|
|
77
77
|
}
|
|
78
78
|
const hex = num.toString(16).padStart(32, "0");
|
|
79
79
|
if (hex.length !== 32) {
|
|
80
|
-
throw new Uuid58DecodeError(base58);
|
|
80
|
+
throw new Uuid58DecodeError(`length not 32: ${base58}`);
|
|
81
81
|
}
|
|
82
82
|
return (hex.slice(0, 8) +
|
|
83
83
|
"-" +
|
package/esm/encode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../src/encode.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;CAI3C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAwBzE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../src/encode.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;CAI3C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAwBzE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAwBjD"}
|
package/esm/encode.js
CHANGED
|
@@ -72,14 +72,14 @@ export function uuid58EncodeSafe(uuid) {
|
|
|
72
72
|
export function uuid58Encode(uuid) {
|
|
73
73
|
const hex = uuid.replaceAll("-", "");
|
|
74
74
|
if (hex.length !== 32) {
|
|
75
|
-
throw new Uuid58EncodeError(uuid);
|
|
75
|
+
throw new Uuid58EncodeError(`Invalid UUID length: expected 32 characters (excluding hyphens), got ${hex.length} characters in "${uuid}"`);
|
|
76
76
|
}
|
|
77
77
|
let num;
|
|
78
78
|
try {
|
|
79
79
|
num = BigInt("0x" + hex);
|
|
80
80
|
}
|
|
81
81
|
catch {
|
|
82
|
-
throw new Uuid58EncodeError(uuid);
|
|
82
|
+
throw new Uuid58EncodeError(`Invalid UUID format: "${uuid}" contains non-hexadecimal characters`);
|
|
83
83
|
}
|
|
84
84
|
let encoded = "";
|
|
85
85
|
do {
|
package/package.json
CHANGED
package/script/decode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../src/decode.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;CAI3C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CA4B3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../src/decode.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;CAI3C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CA4B3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA4BnD"}
|
package/script/decode.js
CHANGED
|
@@ -77,13 +77,13 @@ function uuid58Decode(base58) {
|
|
|
77
77
|
for (const char of base58) {
|
|
78
78
|
const index = BASE58_MAP[char];
|
|
79
79
|
if (index === undefined) {
|
|
80
|
-
throw new Uuid58DecodeError(base58);
|
|
80
|
+
throw new Uuid58DecodeError(`Character '${char}' is not a valid Base58 character in string: ${base58}`);
|
|
81
81
|
}
|
|
82
82
|
num = num * alphabet_js_1.ALPHABET_LENGTH + index;
|
|
83
83
|
}
|
|
84
84
|
const hex = num.toString(16).padStart(32, "0");
|
|
85
85
|
if (hex.length !== 32) {
|
|
86
|
-
throw new Uuid58DecodeError(base58);
|
|
86
|
+
throw new Uuid58DecodeError(`length not 32: ${base58}`);
|
|
87
87
|
}
|
|
88
88
|
return (hex.slice(0, 8) +
|
|
89
89
|
"-" +
|
package/script/encode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../src/encode.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;CAI3C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAwBzE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../src/encode.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;CAI3C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAwBzE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAwBjD"}
|
package/script/encode.js
CHANGED
|
@@ -78,14 +78,14 @@ function uuid58EncodeSafe(uuid) {
|
|
|
78
78
|
function uuid58Encode(uuid) {
|
|
79
79
|
const hex = uuid.replaceAll("-", "");
|
|
80
80
|
if (hex.length !== 32) {
|
|
81
|
-
throw new Uuid58EncodeError(uuid);
|
|
81
|
+
throw new Uuid58EncodeError(`Invalid UUID length: expected 32 characters (excluding hyphens), got ${hex.length} characters in "${uuid}"`);
|
|
82
82
|
}
|
|
83
83
|
let num;
|
|
84
84
|
try {
|
|
85
85
|
num = BigInt("0x" + hex);
|
|
86
86
|
}
|
|
87
87
|
catch {
|
|
88
|
-
throw new Uuid58EncodeError(uuid);
|
|
88
|
+
throw new Uuid58EncodeError(`Invalid UUID format: "${uuid}" contains non-hexadecimal characters`);
|
|
89
89
|
}
|
|
90
90
|
let encoded = "";
|
|
91
91
|
do {
|