@nakanoaas/uuid58 1.0.1 → 1.0.2
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/README.md +5 -0
- package/esm/decode.js +3 -5
- package/esm/encode.js +3 -5
- package/package.json +3 -1
- package/script/decode.js +3 -5
- package/script/encode.js +3 -5
package/README.md
CHANGED
|
@@ -18,6 +18,11 @@ shorter, URL-safe identifiers while maintaining the uniqueness of UUIDs.
|
|
|
18
18
|
- 📦 Supports both ESM and CommonJS
|
|
19
19
|
- 🛡️ Provides safe APIs that return error objects instead of throwing exceptions
|
|
20
20
|
|
|
21
|
+
## Try it out!
|
|
22
|
+
|
|
23
|
+
[UUID58 Playground](https://nakanoasaservice.github.io/uuid58-playground/) - Try
|
|
24
|
+
generating, encoding, and decoding UUID58 in real-time!
|
|
25
|
+
|
|
21
26
|
## Installation
|
|
22
27
|
|
|
23
28
|
### Deno
|
package/esm/decode.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
import { ALPHABET_LENGTH, BASE58_ALPHABET } from "./alphabet.js";
|
|
3
2
|
// Fast lookup map from alphabet characters to their indices
|
|
4
3
|
const BASE58_MAP = {};
|
|
@@ -10,11 +9,10 @@ for (let i = 0; i < BASE58_ALPHABET.length; i++) {
|
|
|
10
9
|
* This includes strings containing characters not in the Base58 alphabet.
|
|
11
10
|
*/
|
|
12
11
|
export class Uuid58DecodeError extends Error {
|
|
12
|
+
static {
|
|
13
|
+
this.prototype.name = "Uuid58DecodeError";
|
|
14
|
+
}
|
|
13
15
|
}
|
|
14
|
-
_a = Uuid58DecodeError;
|
|
15
|
-
(() => {
|
|
16
|
-
_a.prototype.name = "Uuid58DecodeError";
|
|
17
|
-
})();
|
|
18
16
|
/**
|
|
19
17
|
* Converts a 22-character Base58-encoded string back to a standard UUID format, but instead of
|
|
20
18
|
* throwing an error for invalid input, it returns an `Uuid58DecodeError`
|
package/esm/encode.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
import { ALPHABET_LENGTH, BASE58_ALPHABET } from "./alphabet.js";
|
|
3
2
|
/**
|
|
4
3
|
* Error thrown when an invalid UUID string is provided for encoding.
|
|
5
4
|
* This includes strings that don't match the standard UUID format (32 hexadecimal characters with optional hyphens).
|
|
6
5
|
*/
|
|
7
6
|
export class Uuid58EncodeError extends Error {
|
|
7
|
+
static {
|
|
8
|
+
this.prototype.name = "Uuid58EncodeError";
|
|
9
|
+
}
|
|
8
10
|
}
|
|
9
|
-
_a = Uuid58EncodeError;
|
|
10
|
-
(() => {
|
|
11
|
-
_a.prototype.name = "Uuid58EncodeError";
|
|
12
|
-
})();
|
|
13
11
|
/**
|
|
14
12
|
* Converts a standard UUID string to a 22-character Base58-encoded format, but instead of
|
|
15
13
|
* throwing an error for invalid input, it returns an `Uuid58EncodeError` instance.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nakanoaas/uuid58",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A tiny, zero-dependency library for generating and converting UUIDs to Base58-encoded strings.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"require": "./script/index.js"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
+
"scripts": {},
|
|
22
|
+
"sideEffects": false,
|
|
21
23
|
"devDependencies": {
|
|
22
24
|
"@types/node": "^20.9.0"
|
|
23
25
|
},
|
package/script/decode.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.Uuid58DecodeError = void 0;
|
|
5
4
|
exports.uuid58DecodeSafe = uuid58DecodeSafe;
|
|
@@ -15,12 +14,11 @@ for (let i = 0; i < alphabet_js_1.BASE58_ALPHABET.length; i++) {
|
|
|
15
14
|
* This includes strings containing characters not in the Base58 alphabet.
|
|
16
15
|
*/
|
|
17
16
|
class Uuid58DecodeError extends Error {
|
|
17
|
+
static {
|
|
18
|
+
this.prototype.name = "Uuid58DecodeError";
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
21
|
exports.Uuid58DecodeError = Uuid58DecodeError;
|
|
20
|
-
_a = Uuid58DecodeError;
|
|
21
|
-
(() => {
|
|
22
|
-
_a.prototype.name = "Uuid58DecodeError";
|
|
23
|
-
})();
|
|
24
22
|
/**
|
|
25
23
|
* Converts a 22-character Base58-encoded string back to a standard UUID format, but instead of
|
|
26
24
|
* throwing an error for invalid input, it returns an `Uuid58DecodeError`
|
package/script/encode.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.Uuid58EncodeError = void 0;
|
|
5
4
|
exports.uuid58EncodeSafe = uuid58EncodeSafe;
|
|
@@ -10,12 +9,11 @@ const alphabet_js_1 = require("./alphabet.js");
|
|
|
10
9
|
* This includes strings that don't match the standard UUID format (32 hexadecimal characters with optional hyphens).
|
|
11
10
|
*/
|
|
12
11
|
class Uuid58EncodeError extends Error {
|
|
12
|
+
static {
|
|
13
|
+
this.prototype.name = "Uuid58EncodeError";
|
|
14
|
+
}
|
|
13
15
|
}
|
|
14
16
|
exports.Uuid58EncodeError = Uuid58EncodeError;
|
|
15
|
-
_a = Uuid58EncodeError;
|
|
16
|
-
(() => {
|
|
17
|
-
_a.prototype.name = "Uuid58EncodeError";
|
|
18
|
-
})();
|
|
19
17
|
/**
|
|
20
18
|
* Converts a standard UUID string to a 22-character Base58-encoded format, but instead of
|
|
21
19
|
* throwing an error for invalid input, it returns an `Uuid58EncodeError` instance.
|