@powfix/core-js 0.23.1 → 0.23.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.
|
@@ -48,13 +48,39 @@ var UuidUtils = /*#__PURE__*/ function() {
|
|
|
48
48
|
_create_class(UuidUtils, null, [
|
|
49
49
|
{
|
|
50
50
|
key: "v4",
|
|
51
|
-
value:
|
|
51
|
+
value: /**
|
|
52
|
+
* Generate a random UUID v4 string.
|
|
53
|
+
*
|
|
54
|
+
* @deprecated This method is deprecated and will be removed in future versions.
|
|
55
|
+
* Please use the `UUID` class from the `@powfix/uuid` package instead:
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { UUID } from "@powfix/uuid";
|
|
59
|
+
* UUID.v4().toString();
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @returns {string} A randomly generated UUID v4 string.
|
|
63
|
+
*/ function v4() {
|
|
52
64
|
return uuid__namespace.v4();
|
|
53
65
|
}
|
|
54
66
|
},
|
|
55
67
|
{
|
|
56
68
|
key: "format",
|
|
57
|
-
value:
|
|
69
|
+
value: /**
|
|
70
|
+
* Format a UUID string with or without dashes into the canonical
|
|
71
|
+
* lowercase dashed UUID string representation.
|
|
72
|
+
*
|
|
73
|
+
* @deprecated This method is deprecated and will be removed in future versions.
|
|
74
|
+
* Please use the `UUID` class from the `@powfix/uuid` package instead:
|
|
75
|
+
*
|
|
76
|
+
* ```ts
|
|
77
|
+
* import { UUID } from "@powfix/uuid";
|
|
78
|
+
* UUID.fromString(str).toString();
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @param uuid A UUID string (32 characters without dashes, or 36 characters with dashes).
|
|
82
|
+
* @returns {string} Canonical UUID string in lowercase with dashes.
|
|
83
|
+
*/ function format(uuid2) {
|
|
58
84
|
if (uuid2.length === 32) {
|
|
59
85
|
return "".concat(uuid2.substring(0, 8), "-").concat(uuid2.substring(8, 12), "-").concat(uuid2.substring(12, 16), "-").concat(uuid2.substring(16, 20), "-").concat(uuid2.substring(20, 32)).toLowerCase();
|
|
60
86
|
} else if (uuid2.length === 36) {
|
|
@@ -83,7 +109,17 @@ var UuidUtils = /*#__PURE__*/ function() {
|
|
|
83
109
|
},
|
|
84
110
|
{
|
|
85
111
|
key: "isValidUUID",
|
|
86
|
-
value:
|
|
112
|
+
value: /**
|
|
113
|
+
* Check is provided uuid string is valid UUID
|
|
114
|
+
*
|
|
115
|
+
* @deprecated This method is deprecated and will be removed in future versions.
|
|
116
|
+
* Please use the `UUID` class from the `@powfix/uuid` package instead:
|
|
117
|
+
*
|
|
118
|
+
* ```ts
|
|
119
|
+
* import { UUID } from "@powfix/uuid";
|
|
120
|
+
* UUID.isValidString(uuid);
|
|
121
|
+
* ```
|
|
122
|
+
*/ function isValidUUID(uuid2) {
|
|
87
123
|
if (!uuid2) return false;
|
|
88
124
|
if (typeof uuid2 !== "string") return false;
|
|
89
125
|
return RegExp(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/i).test(uuid2);
|
|
@@ -1,15 +1,73 @@
|
|
|
1
1
|
declare class UuidUtils {
|
|
2
|
+
/**
|
|
3
|
+
* Generate a random UUID v4 string.
|
|
4
|
+
*
|
|
5
|
+
* @deprecated This method is deprecated and will be removed in future versions.
|
|
6
|
+
* Please use the `UUID` class from the `@powfix/uuid` package instead:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { UUID } from "@powfix/uuid";
|
|
10
|
+
* UUID.v4().toString();
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @returns {string} A randomly generated UUID v4 string.
|
|
14
|
+
*/
|
|
2
15
|
static v4(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Format a UUID string with or without dashes into the canonical
|
|
18
|
+
* lowercase dashed UUID string representation.
|
|
19
|
+
*
|
|
20
|
+
* @deprecated This method is deprecated and will be removed in future versions.
|
|
21
|
+
* Please use the `UUID` class from the `@powfix/uuid` package instead:
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { UUID } from "@powfix/uuid";
|
|
25
|
+
* UUID.fromString(str).toString();
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @param uuid A UUID string (32 characters without dashes, or 36 characters with dashes).
|
|
29
|
+
* @returns {string} Canonical UUID string in lowercase with dashes.
|
|
30
|
+
*/
|
|
3
31
|
static format(uuid: string): string;
|
|
4
32
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @
|
|
33
|
+
* Convert a UUID Buffer/Uint8Array into a string representation.
|
|
34
|
+
*
|
|
35
|
+
* @deprecated This method is deprecated and will be removed in future versions.
|
|
36
|
+
* Please use the `UUID` class from the `@powfix/uuid` package instead:
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { UUID } from "@powfix/uuid";
|
|
40
|
+
* UUID.fromBuffer(binary).toString();
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @param binary A UUID in Buffer or Uint8Array form.
|
|
44
|
+
* @returns {string|null} The UUID string, or null if the input is not provided.
|
|
8
45
|
*/
|
|
9
46
|
static toString(binary: Uint8Array): string;
|
|
10
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Convert a UUID string to a Buffer.
|
|
49
|
+
*
|
|
50
|
+
* @deprecated This method is deprecated and will be removed in future versions.
|
|
51
|
+
* Please use the `UUID` class from the `@powfix/uuid` package instead:
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { UUID } from "@powfix/uuid";
|
|
55
|
+
* UUID.fromString(uuid).toBuffer();
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
11
58
|
static toBuffer(uuid: string): Buffer;
|
|
12
59
|
static toBuffer(uuid: string | null | undefined): Buffer | null;
|
|
60
|
+
/**
|
|
61
|
+
* Check is provided uuid string is valid UUID
|
|
62
|
+
*
|
|
63
|
+
* @deprecated This method is deprecated and will be removed in future versions.
|
|
64
|
+
* Please use the `UUID` class from the `@powfix/uuid` package instead:
|
|
65
|
+
*
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { UUID } from "@powfix/uuid";
|
|
68
|
+
* UUID.isValidString(uuid);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
13
71
|
static isValidUUID(uuid: string): boolean;
|
|
14
72
|
}
|
|
15
73
|
|
|
@@ -28,13 +28,39 @@ var UuidUtils = /*#__PURE__*/ function() {
|
|
|
28
28
|
_create_class(UuidUtils, null, [
|
|
29
29
|
{
|
|
30
30
|
key: "v4",
|
|
31
|
-
value:
|
|
31
|
+
value: /**
|
|
32
|
+
* Generate a random UUID v4 string.
|
|
33
|
+
*
|
|
34
|
+
* @deprecated This method is deprecated and will be removed in future versions.
|
|
35
|
+
* Please use the `UUID` class from the `@powfix/uuid` package instead:
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { UUID } from "@powfix/uuid";
|
|
39
|
+
* UUID.v4().toString();
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @returns {string} A randomly generated UUID v4 string.
|
|
43
|
+
*/ function v4() {
|
|
32
44
|
return uuid.v4();
|
|
33
45
|
}
|
|
34
46
|
},
|
|
35
47
|
{
|
|
36
48
|
key: "format",
|
|
37
|
-
value:
|
|
49
|
+
value: /**
|
|
50
|
+
* Format a UUID string with or without dashes into the canonical
|
|
51
|
+
* lowercase dashed UUID string representation.
|
|
52
|
+
*
|
|
53
|
+
* @deprecated This method is deprecated and will be removed in future versions.
|
|
54
|
+
* Please use the `UUID` class from the `@powfix/uuid` package instead:
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { UUID } from "@powfix/uuid";
|
|
58
|
+
* UUID.fromString(str).toString();
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @param uuid A UUID string (32 characters without dashes, or 36 characters with dashes).
|
|
62
|
+
* @returns {string} Canonical UUID string in lowercase with dashes.
|
|
63
|
+
*/ function format(uuid2) {
|
|
38
64
|
if (uuid2.length === 32) {
|
|
39
65
|
return "".concat(uuid2.substring(0, 8), "-").concat(uuid2.substring(8, 12), "-").concat(uuid2.substring(12, 16), "-").concat(uuid2.substring(16, 20), "-").concat(uuid2.substring(20, 32)).toLowerCase();
|
|
40
66
|
} else if (uuid2.length === 36) {
|
|
@@ -63,7 +89,17 @@ var UuidUtils = /*#__PURE__*/ function() {
|
|
|
63
89
|
},
|
|
64
90
|
{
|
|
65
91
|
key: "isValidUUID",
|
|
66
|
-
value:
|
|
92
|
+
value: /**
|
|
93
|
+
* Check is provided uuid string is valid UUID
|
|
94
|
+
*
|
|
95
|
+
* @deprecated This method is deprecated and will be removed in future versions.
|
|
96
|
+
* Please use the `UUID` class from the `@powfix/uuid` package instead:
|
|
97
|
+
*
|
|
98
|
+
* ```ts
|
|
99
|
+
* import { UUID } from "@powfix/uuid";
|
|
100
|
+
* UUID.isValidString(uuid);
|
|
101
|
+
* ```
|
|
102
|
+
*/ function isValidUUID(uuid2) {
|
|
67
103
|
if (!uuid2) return false;
|
|
68
104
|
if (typeof uuid2 !== "string") return false;
|
|
69
105
|
return RegExp(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/i).test(uuid2);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powfix/core-js",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.2",
|
|
4
4
|
"description": "core package",
|
|
5
5
|
"author": "Kwon Kyung-Min <powfix@gmail.com>",
|
|
6
6
|
"private": false,
|
|
@@ -19,6 +19,21 @@
|
|
|
19
19
|
"main": "./dist/index.cjs",
|
|
20
20
|
"module": "./dist/index.js",
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
|
+
"scripts": {
|
|
23
|
+
"clean": "rm -rf dist | wc -l",
|
|
24
|
+
"esmfix": "tsc-esm-fix --ext='.mjs'",
|
|
25
|
+
"compile": "tsc",
|
|
26
|
+
"prebuild": "yarn run clean && yarn run compile",
|
|
27
|
+
"build": "yarn run build:cjs && yarn run build:esm",
|
|
28
|
+
"build:cjs": "tsup --config tsup.cjs.config.ts",
|
|
29
|
+
"build:esm": "tsup --config tsup.esm.config.ts"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
22
37
|
"exports": {
|
|
23
38
|
".": {
|
|
24
39
|
"types": "./dist/index.d.ts",
|
|
@@ -36,17 +51,6 @@
|
|
|
36
51
|
"require": "./dist/index.node.cjs"
|
|
37
52
|
}
|
|
38
53
|
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"clean": "rm -rf dist | wc -l",
|
|
41
|
-
"esmfix": "tsc-esm-fix --ext='.mjs'",
|
|
42
|
-
"prebuild": "yarn clean",
|
|
43
|
-
"build": "yarn run build:cjs && yarn run build:esm",
|
|
44
|
-
"build:cjs": "tsup --config tsup.cjs.config.ts",
|
|
45
|
-
"build:esm": "tsup --config tsup.esm.config.ts"
|
|
46
|
-
},
|
|
47
|
-
"files": [
|
|
48
|
-
"dist"
|
|
49
|
-
],
|
|
50
54
|
"dependencies": {
|
|
51
55
|
"base-64": "^1.0.0",
|
|
52
56
|
"eventemitter3": "^5.0.1",
|
|
@@ -54,7 +58,7 @@
|
|
|
54
58
|
"uuid": "9.0.1"
|
|
55
59
|
},
|
|
56
60
|
"devDependencies": {
|
|
57
|
-
"@powfix/uuid": "^0.2.
|
|
61
|
+
"@powfix/uuid": "^0.2.3",
|
|
58
62
|
"@swc/core": "^1.13.5",
|
|
59
63
|
"@types/base-64": "1.0.2",
|
|
60
64
|
"@types/node": "^24.5.1",
|