@kikiutils/shared 14.1.1 → 15.0.0
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/dist/buffer.d.ts +0 -1
- package/dist/buffer.d.ts.map +1 -1
- package/dist/buffer.js +1 -2
- package/dist/buffer.js.map +1 -1
- package/dist/classes/path.d.ts +1 -28
- package/dist/classes/path.d.ts.map +1 -1
- package/dist/classes/path.js +1 -35
- package/dist/classes/path.js.map +1 -1
- package/dist/classes/precision-number.d.ts.map +1 -1
- package/dist/classes/precision-number.js +1 -2
- package/dist/classes/precision-number.js.map +1 -1
- package/dist/classes/ssh-client.d.ts.map +1 -1
- package/dist/classes/ssh-client.js +1 -2
- package/dist/classes/ssh-client.js.map +1 -1
- package/dist/clipboard.d.ts.map +1 -1
- package/dist/clipboard.js +1 -1
- package/dist/consola.d.ts +3 -4
- package/dist/consola.d.ts.map +1 -1
- package/dist/consola.js +1 -2
- package/dist/consola.js.map +1 -1
- package/dist/crypto-hash.d.ts +0 -1
- package/dist/crypto-hash.d.ts.map +1 -1
- package/dist/crypto-hash.js +1 -2
- package/dist/crypto-hash.js.map +1 -1
- package/dist/datetime.d.ts.map +1 -1
- package/dist/datetime.js +1 -2
- package/dist/datetime.js.map +1 -1
- package/dist/element-plus.d.ts.map +1 -1
- package/dist/element-plus.js +1 -1
- package/dist/enum.d.ts.map +1 -1
- package/dist/enum.js +1 -1
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +1 -1
- package/dist/env.js.map +1 -1
- package/dist/event-awaiter.d.ts.map +1 -1
- package/dist/event-awaiter.js +7 -7
- package/dist/event-awaiter.js.map +1 -1
- package/dist/general.d.ts.map +1 -1
- package/dist/general.js +1 -1
- package/dist/hash.d.ts.map +1 -1
- package/dist/hash.js +1 -2
- package/dist/hash.js.map +1 -1
- package/dist/math.d.ts.map +1 -1
- package/dist/math.js +1 -2
- package/dist/math.js.map +1 -1
- package/dist/number.d.ts +0 -1
- package/dist/number.d.ts.map +1 -1
- package/dist/number.js +1 -2
- package/dist/number.js.map +1 -1
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +1 -1
- package/dist/pino.d.ts +3 -4
- package/dist/pino.d.ts.map +1 -1
- package/dist/pino.js +6 -12
- package/dist/pino.js.map +1 -1
- package/dist/random.d.ts.map +1 -1
- package/dist/random.js +1 -1
- package/dist/storages/lru/keyed-store.d.ts.map +1 -1
- package/dist/storages/lru/keyed-store.js +1 -1
- package/dist/storages/redis/keyed-store.d.ts.map +1 -1
- package/dist/storages/redis/keyed-store.js +1 -1
- package/dist/storages/redis/msgpack.d.ts.map +1 -1
- package/dist/storages/redis/msgpack.js +1 -2
- package/dist/storages/redis/msgpack.js.map +1 -1
- package/dist/storages/redis/types.d.ts.map +1 -1
- package/dist/storages/redis/types.js +1 -1
- package/dist/string.d.ts.map +1 -1
- package/dist/string.js +2 -2
- package/dist/string.js.map +1 -1
- package/dist/time.d.ts.map +1 -1
- package/dist/time.js +1 -1
- package/dist/time.js.map +1 -1
- package/dist/types/filtered-key-path.d.ts +3 -4
- package/dist/types/filtered-key-path.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/vue.d.ts +0 -1
- package/dist/types/vue.d.ts.map +1 -1
- package/dist/url.d.ts.map +1 -1
- package/dist/url.js +1 -1
- package/dist/vue.d.ts +0 -1
- package/dist/vue.d.ts.map +1 -1
- package/dist/vue.js +1 -2
- package/dist/vue.js.map +1 -1
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +1 -2
- package/dist/web.js.map +1 -1
- package/package.json +27 -43
- package/src/classes/path.ts +0 -47
- package/src/string.ts +1 -1
package/dist/vue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.js","names":[],"sources":["../src/vue.ts"],"sourcesContent":["import { onActivated } from 'vue';\nimport type { Ref } from 'vue';\nimport {\n onBeforeRouteLeave,\n useRoute,\n} from 'vue-router';\n\nimport type { Nullable } from './types';\nimport { appendRedirectParamToUrl } from './url';\n\n/**\n * Appends the current Vue Router route's fullPath as the `redirect` query parameter to the given URL.\n *\n * @param {string} url - The base URL to modify\n *\n * @returns {string} A new URL with the current route fullPath as the `redirect` parameter\n */\nexport function appendRedirectParamFromCurrentRouteToUrl(url: string) {\n return appendRedirectParamToUrl(url, useRoute().fullPath);\n}\n\n/**\n * Clears an interval referenced by a Vue ref and sets it to null.\n *\n * @param {Ref<Nullable<ReturnType<typeof setInterval>>>} intervalRef - A Vue ref holding a NodeJS.Timeout or null\n */\nexport function clearIntervalRef(intervalRef: Ref<Nullable<ReturnType<typeof setInterval>>>) {\n if (intervalRef.value) clearInterval(intervalRef.value);\n intervalRef.value = null;\n}\n\n/**\n * Clears a timeout referenced by a Vue ref and sets it to null.\n *\n * @param {Ref<Nullable<ReturnType<typeof setTimeout>>>} timeoutRef - A Vue ref holding a NodeJS.Timeout or null\n */\nexport function clearTimeoutRef(timeoutRef: Ref<Nullable<ReturnType<typeof setTimeout>>>) {\n if (timeoutRef.value) clearTimeout(timeoutRef.value);\n timeoutRef.value = null;\n}\n\n/**\n * A Vue composition function that remembers and restores scroll position\n * of a scrollable container across route changes and keep-alive activation.\n *\n * @template T - The type of the scrollable element (defaults to HTMLElement)\n *\n * @param {Ref<Nullable<T>>} containerRef - A ref to the scrollable HTML element\n */\nexport function usePreserveScroll<T extends Element = HTMLElement>(containerRef: Ref<Nullable<T>>) {\n let scrollLeft = 0;\n let scrollTop = 0;\n onActivated(() => {\n if (!containerRef.value) return;\n containerRef.value.scrollLeft = scrollLeft;\n containerRef.value.scrollTop = scrollTop;\n });\n\n onBeforeRouteLeave(() => {\n scrollLeft = containerRef.value?.scrollLeft || 0;\n scrollTop = containerRef.value?.scrollTop || 0;\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"vue.js","names":[],"sources":["../src/vue.ts"],"sourcesContent":["import { onActivated } from 'vue';\nimport type { Ref } from 'vue';\nimport {\n onBeforeRouteLeave,\n useRoute,\n} from 'vue-router';\n\nimport type { Nullable } from './types';\nimport { appendRedirectParamToUrl } from './url';\n\n/**\n * Appends the current Vue Router route's fullPath as the `redirect` query parameter to the given URL.\n *\n * @param {string} url - The base URL to modify\n *\n * @returns {string} A new URL with the current route fullPath as the `redirect` parameter\n */\nexport function appendRedirectParamFromCurrentRouteToUrl(url: string) {\n return appendRedirectParamToUrl(url, useRoute().fullPath);\n}\n\n/**\n * Clears an interval referenced by a Vue ref and sets it to null.\n *\n * @param {Ref<Nullable<ReturnType<typeof setInterval>>>} intervalRef - A Vue ref holding a NodeJS.Timeout or null\n */\nexport function clearIntervalRef(intervalRef: Ref<Nullable<ReturnType<typeof setInterval>>>) {\n if (intervalRef.value) clearInterval(intervalRef.value);\n intervalRef.value = null;\n}\n\n/**\n * Clears a timeout referenced by a Vue ref and sets it to null.\n *\n * @param {Ref<Nullable<ReturnType<typeof setTimeout>>>} timeoutRef - A Vue ref holding a NodeJS.Timeout or null\n */\nexport function clearTimeoutRef(timeoutRef: Ref<Nullable<ReturnType<typeof setTimeout>>>) {\n if (timeoutRef.value) clearTimeout(timeoutRef.value);\n timeoutRef.value = null;\n}\n\n/**\n * A Vue composition function that remembers and restores scroll position\n * of a scrollable container across route changes and keep-alive activation.\n *\n * @template T - The type of the scrollable element (defaults to HTMLElement)\n *\n * @param {Ref<Nullable<T>>} containerRef - A ref to the scrollable HTML element\n */\nexport function usePreserveScroll<T extends Element = HTMLElement>(containerRef: Ref<Nullable<T>>) {\n let scrollLeft = 0;\n let scrollTop = 0;\n onActivated(() => {\n if (!containerRef.value) return;\n containerRef.value.scrollLeft = scrollLeft;\n containerRef.value.scrollTop = scrollTop;\n });\n\n onBeforeRouteLeave(() => {\n scrollLeft = containerRef.value?.scrollLeft || 0;\n scrollTop = containerRef.value?.scrollTop || 0;\n });\n}\n"],"mappings":";;;;;;;;;;;AAiBA,SAAgB,yCAAyC,KAAa;AAClE,QAAO,yBAAyB,KAAK,UAAU,CAAC,SAAS;;;;;;;AAQ7D,SAAgB,iBAAiB,aAA4D;AACzF,KAAI,YAAY,MAAO,eAAc,YAAY,MAAM;AACvD,aAAY,QAAQ;;;;;;;AAQxB,SAAgB,gBAAgB,YAA0D;AACtF,KAAI,WAAW,MAAO,cAAa,WAAW,MAAM;AACpD,YAAW,QAAQ;;;;;;;;;;AAWvB,SAAgB,kBAAmD,cAAgC;CAC/F,IAAI,aAAa;CACjB,IAAI,YAAY;AAChB,mBAAkB;AACd,MAAI,CAAC,aAAa,MAAO;AACzB,eAAa,MAAM,aAAa;AAChC,eAAa,MAAM,YAAY;GACjC;AAEF,0BAAyB;AACrB,eAAa,aAAa,OAAO,cAAc;AAC/C,cAAY,aAAa,OAAO,aAAa;GAC/C"}
|
package/dist/web.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.ts","names":[],"sources":["../src/web.ts"],"
|
|
1
|
+
{"version":3,"file":"web.d.ts","names":[],"sources":["../src/web.ts"],"mappings":";;AASA;;;;;AAeA;iBAfgB,2CAAA,CAA4C,GAAA;;;;;;;;;;;iBAe5C,6CAAA,CAA8C,GAAA,UAAa,OAAA,YAAgB,MAAA,CAAA,OAAA"}
|
package/dist/web.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { appendRedirectParamToUrl } from "./url.js";
|
|
2
|
-
|
|
3
2
|
//#region src/web.ts
|
|
4
3
|
/**
|
|
5
4
|
* Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.
|
|
@@ -25,7 +24,7 @@ function assignUrlWithRedirectParamFromCurrentLocation(url, delayMs) {
|
|
|
25
24
|
if (delayMs === void 0) window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url));
|
|
26
25
|
else return setTimeout(() => window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url)), delayMs);
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
//#endregion
|
|
30
28
|
export { appendRedirectParamFromCurrentLocationToUrl, assignUrlWithRedirectParamFromCurrentLocation };
|
|
29
|
+
|
|
31
30
|
//# sourceMappingURL=web.js.map
|
package/dist/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","names":[],"sources":["../src/web.ts"],"sourcesContent":["import { appendRedirectParamToUrl } from './url';\n\n/**\n * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.\n *\n * @param {string} url - The base URL to modify\n *\n * @returns {string} A new URL with the current location as the `redirect` parameter\n */\nexport function appendRedirectParamFromCurrentLocationToUrl(url: string) {\n const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;\n return appendRedirectParamToUrl(url, currentPath);\n}\n\n/**\n * Navigates to the given URL, appending the current browser location\n * (path, query, and hash) as the `redirect` query parameter.\n *\n * Useful for redirecting to login or other gateways while preserving\n * the current location for post-auth navigation.\n *\n * @param {string} url - The destination URL to navigate to\n * @param {number} [delayMs] - Optional delay in milliseconds before navigation\n */\nexport function assignUrlWithRedirectParamFromCurrentLocation(url: string, delayMs?: number) {\n if (delayMs === undefined) window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url));\n else return setTimeout(() => window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url)), delayMs);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"web.js","names":[],"sources":["../src/web.ts"],"sourcesContent":["import { appendRedirectParamToUrl } from './url';\n\n/**\n * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.\n *\n * @param {string} url - The base URL to modify\n *\n * @returns {string} A new URL with the current location as the `redirect` parameter\n */\nexport function appendRedirectParamFromCurrentLocationToUrl(url: string) {\n const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;\n return appendRedirectParamToUrl(url, currentPath);\n}\n\n/**\n * Navigates to the given URL, appending the current browser location\n * (path, query, and hash) as the `redirect` query parameter.\n *\n * Useful for redirecting to login or other gateways while preserving\n * the current location for post-auth navigation.\n *\n * @param {string} url - The destination URL to navigate to\n * @param {number} [delayMs] - Optional delay in milliseconds before navigation\n */\nexport function assignUrlWithRedirectParamFromCurrentLocation(url: string, delayMs?: number) {\n if (delayMs === undefined) window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url));\n else return setTimeout(() => window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url)), delayMs);\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,4CAA4C,KAAa;AAErE,QAAO,yBAAyB,KADZ,GAAG,OAAO,SAAS,WAAW,OAAO,SAAS,SAAS,OAAO,SAAS,OAC1C;;;;;;;;;;;;AAarD,SAAgB,8CAA8C,KAAa,SAAkB;AACzF,KAAI,YAAY,KAAA,EAAW,QAAO,SAAS,OAAO,4CAA4C,IAAI,CAAC;KAC9F,QAAO,iBAAiB,OAAO,SAAS,OAAO,4CAA4C,IAAI,CAAC,EAAE,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kikiutils/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "15.0.0",
|
|
5
5
|
"description": "A lightweight and modular utility library for modern JavaScript and TypeScript — includes secure hashing, flexible logging, datetime tools, Vue/web helpers, storage abstraction, and more.",
|
|
6
6
|
"author": "kiki-kanri",
|
|
7
7
|
"license": "MIT",
|
|
@@ -56,47 +56,38 @@
|
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "tsdown",
|
|
58
58
|
"bumplog": "changelogen --bump --hideAuthorEmail",
|
|
59
|
-
"
|
|
59
|
+
"knip:deps": "knip --dependencies",
|
|
60
|
+
"knip:exports": "knip --exports",
|
|
60
61
|
"lint": "eslint --max-warnings 0",
|
|
61
62
|
"lint:fix": "eslint --fix --max-warnings 0",
|
|
62
63
|
"prepack": "pnpm run build",
|
|
63
64
|
"release": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build && changelogen --hideAuthorEmail --push --release && npm publish",
|
|
64
65
|
"test": "cross-env TZ=UTC vitest run --coverage",
|
|
65
66
|
"test:watch": "cross-env TZ=UTC vitest watch --coverage",
|
|
66
|
-
"typecheck": "tsc -b --noEmit"
|
|
67
|
-
"unused-exports": "ts-unused-exports ./tsconfig.json"
|
|
67
|
+
"typecheck": "tsc -b --noEmit"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@noble/hashes": "^2.0.1",
|
|
71
|
-
"@types/fs-extra": "^11.0.4",
|
|
72
|
-
"@types/jsonfile": "^6.1.4",
|
|
73
71
|
"@types/ssh2": "^1.15.5",
|
|
74
72
|
"async-validator": "^4.2.5",
|
|
75
|
-
"bson": "^7.
|
|
73
|
+
"bson": "^7.2.0",
|
|
76
74
|
"consola": "^3.4.2",
|
|
77
75
|
"date-fns": "^4.1.0",
|
|
78
76
|
"decimal.js": "^10.6.0",
|
|
79
|
-
"element-plus": "^2.13.
|
|
80
|
-
"
|
|
81
|
-
"lru-cache": "^11.2.4",
|
|
77
|
+
"element-plus": "^2.13.5",
|
|
78
|
+
"lru-cache": "^11.2.6",
|
|
82
79
|
"millify": "^6.1.0",
|
|
83
80
|
"msgpackr": "^1.11.8",
|
|
84
81
|
"node-ssh": "^13.2.1",
|
|
85
|
-
"pino": "^10.
|
|
82
|
+
"pino": "^10.3.1",
|
|
86
83
|
"pino-pretty": "^13.1.3",
|
|
87
|
-
"vue": "^3.5.
|
|
88
|
-
"vue-router": "
|
|
84
|
+
"vue": "^3.5.30",
|
|
85
|
+
"vue-router": ">= 4.6.4"
|
|
89
86
|
},
|
|
90
87
|
"peerDependenciesMeta": {
|
|
91
88
|
"@noble/hashes": {
|
|
92
89
|
"optional": true
|
|
93
90
|
},
|
|
94
|
-
"@types/fs-extra": {
|
|
95
|
-
"optional": true
|
|
96
|
-
},
|
|
97
|
-
"@types/jsonfile": {
|
|
98
|
-
"optional": true
|
|
99
|
-
},
|
|
100
91
|
"@types/ssh2": {
|
|
101
92
|
"optional": true
|
|
102
93
|
},
|
|
@@ -118,9 +109,6 @@
|
|
|
118
109
|
"element-plus": {
|
|
119
110
|
"optional": true
|
|
120
111
|
},
|
|
121
|
-
"fs-extra": {
|
|
122
|
-
"optional": true
|
|
123
|
-
},
|
|
124
112
|
"lru-cache": {
|
|
125
113
|
"optional": true
|
|
126
114
|
},
|
|
@@ -147,40 +135,36 @@
|
|
|
147
135
|
}
|
|
148
136
|
},
|
|
149
137
|
"devDependencies": {
|
|
150
|
-
"@antfu/eslint-config": "^7.0
|
|
151
|
-
"@kikiutils/eslint-config": "^
|
|
152
|
-
"@kikiutils/tsconfigs": "^5.0
|
|
138
|
+
"@antfu/eslint-config": "^7.7.0",
|
|
139
|
+
"@kikiutils/eslint-config": "^7.0.2",
|
|
140
|
+
"@kikiutils/tsconfigs": "^5.1.0",
|
|
153
141
|
"@noble/hashes": "^2.0.1",
|
|
154
|
-
"@types/
|
|
155
|
-
"@types/jsonfile": "^6.1.4",
|
|
156
|
-
"@types/node": "^25.0.9",
|
|
142
|
+
"@types/node": "^25.4.0",
|
|
157
143
|
"@types/ssh2": "^1.15.5",
|
|
158
|
-
"@vitest/coverage-v8": "^4.0.
|
|
144
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
159
145
|
"async-validator": "^4.2.5",
|
|
160
|
-
"bson": "^7.
|
|
146
|
+
"bson": "^7.2.0",
|
|
161
147
|
"changelogen": "^0.6.2",
|
|
162
148
|
"consola": "^3.4.2",
|
|
163
149
|
"cross-env": "^10.1.0",
|
|
164
150
|
"date-fns": "^4.1.0",
|
|
165
151
|
"decimal.js": "^10.6.0",
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"lru-cache": "^11.2.4",
|
|
152
|
+
"element-plus": "^2.13.5",
|
|
153
|
+
"jsdom": "^28.1.0",
|
|
154
|
+
"knip": "^5.86.0",
|
|
155
|
+
"lru-cache": "^11.2.6",
|
|
171
156
|
"millify": "^6.1.0",
|
|
172
157
|
"msgpackr": "^1.11.8",
|
|
173
158
|
"node-ssh": "^13.2.1",
|
|
174
|
-
"pino": "^10.
|
|
159
|
+
"pino": "^10.3.1",
|
|
175
160
|
"pino-pretty": "^13.1.3",
|
|
176
|
-
"publint": "^0.3.
|
|
177
|
-
"
|
|
178
|
-
"tsdown": "^0.19.0",
|
|
161
|
+
"publint": "^0.3.18",
|
|
162
|
+
"tsdown": "^0.21.1",
|
|
179
163
|
"typescript": "^5.9.3",
|
|
180
|
-
"unplugin-unused": "^0.5.
|
|
181
|
-
"vitest": "^4.0.
|
|
182
|
-
"vue": "^3.5.
|
|
183
|
-
"vue-router": "^
|
|
164
|
+
"unplugin-unused": "^0.5.7",
|
|
165
|
+
"vitest": "^4.0.18",
|
|
166
|
+
"vue": "^3.5.30",
|
|
167
|
+
"vue-router": "^5.0.3"
|
|
184
168
|
},
|
|
185
169
|
"pnpm": {
|
|
186
170
|
"onlyBuiltDependencies": [
|
package/src/classes/path.ts
CHANGED
|
@@ -17,13 +17,6 @@ import {
|
|
|
17
17
|
} from 'node:path';
|
|
18
18
|
import type * as nodePath from 'node:path';
|
|
19
19
|
|
|
20
|
-
import * as fsExtra from 'fs-extra';
|
|
21
|
-
import type {
|
|
22
|
-
JFReadOptions,
|
|
23
|
-
JFWriteOptions,
|
|
24
|
-
} from 'jsonfile';
|
|
25
|
-
|
|
26
|
-
export type DoNotRemoveOrUseThisType = typeof fsExtra;
|
|
27
20
|
type DropFirstParameters<T extends (...args: any) => any> = Parameters<T> extends [any, ...infer R] ? R : never;
|
|
28
21
|
export type PathLike = fs.PathLike | Path;
|
|
29
22
|
|
|
@@ -385,44 +378,4 @@ export class Path {
|
|
|
385
378
|
writeFile(...args: DropFirstParameters<typeof fsp.writeFile>) {
|
|
386
379
|
return fsp.writeFile(this.#value, ...args);
|
|
387
380
|
}
|
|
388
|
-
|
|
389
|
-
// Some commonly used promise fs extra methods
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* @see {@link fsExtra.ensureDir}
|
|
393
|
-
*/
|
|
394
|
-
ensureDir(options?: fsExtra.EnsureDirOptions | number) {
|
|
395
|
-
return fsExtra.ensureDir(this.#value, options);
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* @see {@link fsExtra.ensureDir}
|
|
400
|
-
*/
|
|
401
|
-
mkdirp = this.ensureDir;
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* @see {@link fsExtra.ensureDir}
|
|
405
|
-
*/
|
|
406
|
-
mkdirs = this.ensureDir;
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* @see {@link fsExtra.readJson}
|
|
410
|
-
*/
|
|
411
|
-
async readJson<T = any>(options?: JFReadOptions) {
|
|
412
|
-
return await fsExtra.readJson(this.#value, options) as T;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* @see {@link fsExtra.remove}
|
|
417
|
-
*/
|
|
418
|
-
remove() {
|
|
419
|
-
return fsExtra.remove(this.#value);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* @see {@link fsExtra.writeJson}
|
|
424
|
-
*/
|
|
425
|
-
writeJson(data: any, options?: JFWriteOptions) {
|
|
426
|
-
return fsExtra.writeJson(this.#value, data, options);
|
|
427
|
-
}
|
|
428
381
|
}
|
package/src/string.ts
CHANGED
|
@@ -46,5 +46,5 @@ export function randomString(length: number, mode: RandomStringMode = 'alphabeti
|
|
|
46
46
|
|
|
47
47
|
const charset = CHARSETS[mode];
|
|
48
48
|
if (!charset) throw new Error(`Unsupported mode: ${mode}`);
|
|
49
|
-
return Array.from({ length }
|
|
49
|
+
return Array.from({ length }).fill(charset[Math.floor(Math.random() * charset.length)]).join('');
|
|
50
50
|
}
|