@nakanoaas/uuid58 0.0.1 → 0.0.3

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 CHANGED
@@ -48,18 +48,18 @@ pnpm add @nakanoaas/uuid58
48
48
  ## Usage
49
49
 
50
50
  ```typescript
51
- import { decodeUuid58, encodeUuid58, uuid58 } from "@nakanoaas/uuid58";
51
+ import { uuid58, uuid58Decode, uuid58Encode } from "@nakanoaas/uuid58";
52
52
 
53
53
  // Generate a new Base58-encoded UUID
54
54
  const id = uuid58();
55
55
  // => "XDY9dmBbcMBXqcRvYw8xJ2"
56
56
 
57
57
  // Convert existing UUID to Base58
58
- const encoded = encodeUuid58("f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf");
58
+ const encoded = uuid58Encode("f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf");
59
59
  // => "XDY9dmBbcMBXqcRvYw8xJ2"
60
60
 
61
61
  // Convert Base58 back to UUID
62
- const decoded = decodeUuid58("XDY9dmBbcMBXqcRvYw8xJ2");
62
+ const decoded = uuid58Decode("XDY9dmBbcMBXqcRvYw8xJ2");
63
63
  // => "f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"
64
64
  ```
65
65
 
@@ -73,12 +73,12 @@ Generates a new Base58-encoded UUID.
73
73
  function uuid58(): string;
74
74
  ```
75
75
 
76
- ### `encodeUuid58(uuid: string)`
76
+ ### `uuid58Encode(uuid: string)`
77
77
 
78
78
  Converts a standard UUID string to a Base58-encoded format.
79
79
 
80
80
  ```typescript
81
- function encodeUuid58(uuid: string): string;
81
+ function uuid58Encode(uuid: string): string;
82
82
  ```
83
83
 
84
84
  - **Parameters:**
@@ -86,12 +86,12 @@ function encodeUuid58(uuid: string): string;
86
86
  - **Returns:** A Base58-encoded string
87
87
  - **Throws:** `InvalidUuidError` if the input is not a valid UUID
88
88
 
89
- ### `decodeUuid58(encoded: string)`
89
+ ### `uuid58Decode(encoded: string)`
90
90
 
91
91
  Converts a Base58-encoded string back to a standard UUID format.
92
92
 
93
93
  ```typescript
94
- function decodeUuid58(encoded: string): string;
94
+ function uuid58Decode(encoded: string): string;
95
95
  ```
96
96
 
97
97
  - **Parameters:**
package/esm/decode.d.ts CHANGED
@@ -14,8 +14,8 @@ export declare class InvalidBase58Error extends Error {
14
14
  *
15
15
  * @example
16
16
  * ```typescript
17
- * const uuid = decodeUuid58("XDY9dmBbcMBXqcRvYw8xJ2"); // returns "f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"
17
+ * const uuid = uuid58Decode("XDY9dmBbcMBXqcRvYw8xJ2"); // returns "f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"
18
18
  * ```
19
19
  */
20
- export declare function decodeUuid58(base58: string): string;
20
+ export declare function uuid58Decode(base58: string): string;
21
21
  //# sourceMappingURL=decode.d.ts.map
package/esm/decode.js CHANGED
@@ -27,10 +27,10 @@ _a = InvalidBase58Error;
27
27
  *
28
28
  * @example
29
29
  * ```typescript
30
- * const uuid = decodeUuid58("XDY9dmBbcMBXqcRvYw8xJ2"); // returns "f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"
30
+ * const uuid = uuid58Decode("XDY9dmBbcMBXqcRvYw8xJ2"); // returns "f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"
31
31
  * ```
32
32
  */
33
- export function decodeUuid58(base58) {
33
+ export function uuid58Decode(base58) {
34
34
  if (!/^[1-9A-HJ-NP-Za-km-z]+$/.test(base58)) {
35
35
  throw new InvalidBase58Error(base58);
36
36
  }
package/esm/encode.d.ts CHANGED
@@ -17,12 +17,12 @@ export declare class InvalidUuidError extends Error {
17
17
  * @example
18
18
  * ```typescript
19
19
  * // With hyphens
20
- * const base58 = encodeUuid58("f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
20
+ * const base58 = uuid58Encode("f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
21
21
  * // Without hyphens
22
- * const base58 = encodeUuid58("f4b247fd1f8745d4aa061c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
22
+ * const base58 = uuid58Encode("f4b247fd1f8745d4aa061c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
23
23
  * // Uppercase UUID is also accepted
24
- * const base58 = encodeUuid58("F4B247FD-1F87-45D4-AA06-1C6FC0A8DFAF"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
24
+ * const base58 = uuid58Encode("F4B247FD-1F87-45D4-AA06-1C6FC0A8DFAF"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
25
25
  * ```
26
26
  */
27
- export declare function encodeUuid58(uuid: string): string;
27
+ export declare function uuid58Encode(uuid: string): string;
28
28
  //# sourceMappingURL=encode.d.ts.map
package/esm/encode.js CHANGED
@@ -25,14 +25,14 @@ _a = InvalidUuidError;
25
25
  * @example
26
26
  * ```typescript
27
27
  * // With hyphens
28
- * const base58 = encodeUuid58("f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
28
+ * const base58 = uuid58Encode("f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
29
29
  * // Without hyphens
30
- * const base58 = encodeUuid58("f4b247fd1f8745d4aa061c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
30
+ * const base58 = uuid58Encode("f4b247fd1f8745d4aa061c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
31
31
  * // Uppercase UUID is also accepted
32
- * const base58 = encodeUuid58("F4B247FD-1F87-45D4-AA06-1C6FC0A8DFAF"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
32
+ * const base58 = uuid58Encode("F4B247FD-1F87-45D4-AA06-1C6FC0A8DFAF"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
33
33
  * ```
34
34
  */
35
- export function encodeUuid58(uuid) {
35
+ export function uuid58Encode(uuid) {
36
36
  const hex = uuid.replace(/-/g, "").toLowerCase();
37
37
  if (!/^[0-9a-f]{32}$/.test(hex)) {
38
38
  throw new InvalidUuidError(uuid);
package/esm/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { encodeUuid58 } from "./encode.js";
2
- export { decodeUuid58 } from "./decode.js";
3
- export { uuid58 } from "./uuid58.js";
1
+ export * from "./decode.js";
2
+ export * from "./encode.js";
3
+ export * from "./uuid58.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
package/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { encodeUuid58 } from "./encode.js";
2
- export { decodeUuid58 } from "./decode.js";
3
- export { uuid58 } from "./uuid58.js";
1
+ export * from "./decode.js";
2
+ export * from "./encode.js";
3
+ export * from "./uuid58.js";
package/esm/uuid58.js CHANGED
@@ -1,4 +1,4 @@
1
- import { encodeUuid58 } from "./encode.js";
1
+ import { uuid58Encode } from "./encode.js";
2
2
  /**
3
3
  * Generates a new Base58-encoded UUID.
4
4
  *
@@ -13,5 +13,5 @@ import { encodeUuid58 } from "./encode.js";
13
13
  * ```
14
14
  */
15
15
  export function uuid58() {
16
- return encodeUuid58(crypto.randomUUID());
16
+ return uuid58Encode(crypto.randomUUID());
17
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nakanoaas/uuid58",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "A tiny, zero-dependency library for generating and converting UUIDs to Base58-encoded strings.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,8 +14,8 @@ export declare class InvalidBase58Error extends Error {
14
14
  *
15
15
  * @example
16
16
  * ```typescript
17
- * const uuid = decodeUuid58("XDY9dmBbcMBXqcRvYw8xJ2"); // returns "f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"
17
+ * const uuid = uuid58Decode("XDY9dmBbcMBXqcRvYw8xJ2"); // returns "f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"
18
18
  * ```
19
19
  */
20
- export declare function decodeUuid58(base58: string): string;
20
+ export declare function uuid58Decode(base58: string): string;
21
21
  //# sourceMappingURL=decode.d.ts.map
package/script/decode.js CHANGED
@@ -2,7 +2,7 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.InvalidBase58Error = void 0;
5
- exports.decodeUuid58 = decodeUuid58;
5
+ exports.uuid58Decode = uuid58Decode;
6
6
  const alphabet_js_1 = require("./alphabet.js");
7
7
  // Fast lookup map from alphabet characters to their indices
8
8
  const BASE58_MAP = {};
@@ -32,10 +32,10 @@ _a = InvalidBase58Error;
32
32
  *
33
33
  * @example
34
34
  * ```typescript
35
- * const uuid = decodeUuid58("XDY9dmBbcMBXqcRvYw8xJ2"); // returns "f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"
35
+ * const uuid = uuid58Decode("XDY9dmBbcMBXqcRvYw8xJ2"); // returns "f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"
36
36
  * ```
37
37
  */
38
- function decodeUuid58(base58) {
38
+ function uuid58Decode(base58) {
39
39
  if (!/^[1-9A-HJ-NP-Za-km-z]+$/.test(base58)) {
40
40
  throw new InvalidBase58Error(base58);
41
41
  }
@@ -17,12 +17,12 @@ export declare class InvalidUuidError extends Error {
17
17
  * @example
18
18
  * ```typescript
19
19
  * // With hyphens
20
- * const base58 = encodeUuid58("f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
20
+ * const base58 = uuid58Encode("f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
21
21
  * // Without hyphens
22
- * const base58 = encodeUuid58("f4b247fd1f8745d4aa061c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
22
+ * const base58 = uuid58Encode("f4b247fd1f8745d4aa061c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
23
23
  * // Uppercase UUID is also accepted
24
- * const base58 = encodeUuid58("F4B247FD-1F87-45D4-AA06-1C6FC0A8DFAF"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
24
+ * const base58 = uuid58Encode("F4B247FD-1F87-45D4-AA06-1C6FC0A8DFAF"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
25
25
  * ```
26
26
  */
27
- export declare function encodeUuid58(uuid: string): string;
27
+ export declare function uuid58Encode(uuid: string): string;
28
28
  //# sourceMappingURL=encode.d.ts.map
package/script/encode.js CHANGED
@@ -2,7 +2,7 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.InvalidUuidError = void 0;
5
- exports.encodeUuid58 = encodeUuid58;
5
+ exports.uuid58Encode = uuid58Encode;
6
6
  const alphabet_js_1 = require("./alphabet.js");
7
7
  /**
8
8
  * Error thrown when an invalid UUID string is provided for encoding.
@@ -30,14 +30,14 @@ _a = InvalidUuidError;
30
30
  * @example
31
31
  * ```typescript
32
32
  * // With hyphens
33
- * const base58 = encodeUuid58("f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
33
+ * const base58 = uuid58Encode("f4b247fd-1f87-45d4-aa06-1c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
34
34
  * // Without hyphens
35
- * const base58 = encodeUuid58("f4b247fd1f8745d4aa061c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
35
+ * const base58 = uuid58Encode("f4b247fd1f8745d4aa061c6fc0a8dfaf"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
36
36
  * // Uppercase UUID is also accepted
37
- * const base58 = encodeUuid58("F4B247FD-1F87-45D4-AA06-1C6FC0A8DFAF"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
37
+ * const base58 = uuid58Encode("F4B247FD-1F87-45D4-AA06-1C6FC0A8DFAF"); // returns "XDY9dmBbcMBXqcRvYw8xJ2"
38
38
  * ```
39
39
  */
40
- function encodeUuid58(uuid) {
40
+ function uuid58Encode(uuid) {
41
41
  const hex = uuid.replace(/-/g, "").toLowerCase();
42
42
  if (!/^[0-9a-f]{32}$/.test(hex)) {
43
43
  throw new InvalidUuidError(uuid);
package/script/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { encodeUuid58 } from "./encode.js";
2
- export { decodeUuid58 } from "./decode.js";
3
- export { uuid58 } from "./uuid58.js";
1
+ export * from "./decode.js";
2
+ export * from "./encode.js";
3
+ export * from "./uuid58.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
package/script/index.js CHANGED
@@ -1,9 +1,19 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uuid58 = exports.decodeUuid58 = exports.encodeUuid58 = void 0;
4
- var encode_js_1 = require("./encode.js");
5
- Object.defineProperty(exports, "encodeUuid58", { enumerable: true, get: function () { return encode_js_1.encodeUuid58; } });
6
- var decode_js_1 = require("./decode.js");
7
- Object.defineProperty(exports, "decodeUuid58", { enumerable: true, get: function () { return decode_js_1.decodeUuid58; } });
8
- var uuid58_js_1 = require("./uuid58.js");
9
- Object.defineProperty(exports, "uuid58", { enumerable: true, get: function () { return uuid58_js_1.uuid58; } });
17
+ __exportStar(require("./decode.js"), exports);
18
+ __exportStar(require("./encode.js"), exports);
19
+ __exportStar(require("./uuid58.js"), exports);
package/script/uuid58.js CHANGED
@@ -16,5 +16,5 @@ const encode_js_1 = require("./encode.js");
16
16
  * ```
17
17
  */
18
18
  function uuid58() {
19
- return (0, encode_js_1.encodeUuid58)(crypto.randomUUID());
19
+ return (0, encode_js_1.uuid58Encode)(crypto.randomUUID());
20
20
  }