@opensumi/ide-utils 2.21.13 → 2.22.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.
Files changed (114) hide show
  1. package/lib/arrays.d.ts +3 -3
  2. package/lib/arrays.d.ts.map +1 -1
  3. package/lib/arrays.js.map +1 -1
  4. package/lib/async.d.ts +3 -3
  5. package/lib/async.d.ts.map +1 -1
  6. package/lib/buffer.js +4 -4
  7. package/lib/buffer.js.map +1 -1
  8. package/lib/character-classifier.js +3 -3
  9. package/lib/character-classifier.js.map +1 -1
  10. package/lib/decorators.d.ts +1 -1
  11. package/lib/decorators.d.ts.map +1 -1
  12. package/lib/encoding.d.ts +7 -1
  13. package/lib/encoding.d.ts.map +1 -1
  14. package/lib/encoding.js +15 -2
  15. package/lib/encoding.js.map +1 -1
  16. package/lib/errors.d.ts +2 -2
  17. package/lib/errors.d.ts.map +1 -1
  18. package/lib/event.d.ts +2 -2
  19. package/lib/event.d.ts.map +1 -1
  20. package/lib/filters.d.ts +3 -3
  21. package/lib/filters.d.ts.map +1 -1
  22. package/lib/filters.js +25 -25
  23. package/lib/filters.js.map +1 -1
  24. package/lib/glob.d.ts +2 -2
  25. package/lib/glob.d.ts.map +1 -1
  26. package/lib/glob.js +1 -1
  27. package/lib/glob.js.map +1 -1
  28. package/lib/hash.js +10 -10
  29. package/lib/hash.js.map +1 -1
  30. package/lib/iterator.d.ts +1 -1
  31. package/lib/iterator.d.ts.map +1 -1
  32. package/lib/linked-text.d.ts +1 -1
  33. package/lib/linked-text.d.ts.map +1 -1
  34. package/lib/linked-text.js.map +1 -1
  35. package/lib/map.js +17 -17
  36. package/lib/map.js.map +1 -1
  37. package/lib/objects.d.ts +1 -0
  38. package/lib/objects.d.ts.map +1 -1
  39. package/lib/objects.js +38 -1
  40. package/lib/objects.js.map +1 -1
  41. package/lib/os.d.ts +1 -8
  42. package/lib/os.d.ts.map +1 -1
  43. package/lib/os.js +4 -8
  44. package/lib/os.js.map +1 -1
  45. package/lib/path.d.ts +1 -1
  46. package/lib/path.d.ts.map +1 -1
  47. package/lib/path.js +29 -29
  48. package/lib/path.js.map +1 -1
  49. package/lib/platform.js +8 -8
  50. package/lib/platform.js.map +1 -1
  51. package/lib/process.d.ts.map +1 -1
  52. package/lib/process.js +28 -13
  53. package/lib/process.js.map +1 -1
  54. package/lib/progress.js +3 -3
  55. package/lib/progress.js.map +1 -1
  56. package/lib/strings.js +9 -9
  57. package/lib/strings.js.map +1 -1
  58. package/lib/types.d.ts +5 -1
  59. package/lib/types.d.ts.map +1 -1
  60. package/lib/types.js +8 -1
  61. package/lib/types.js.map +1 -1
  62. package/lib/uint.js +4 -4
  63. package/lib/uint.js.map +1 -1
  64. package/lib/uri.js +8 -8
  65. package/lib/uri.js.map +1 -1
  66. package/lib/uuid.d.ts +1 -1
  67. package/lib/uuid.d.ts.map +1 -1
  68. package/lib/uuid.js +3 -2
  69. package/lib/uuid.js.map +1 -1
  70. package/package.json +8 -6
  71. package/src/ansi.ts +10 -0
  72. package/src/argv.ts +57 -0
  73. package/src/arrays.ts +328 -0
  74. package/src/async.ts +580 -0
  75. package/src/buffer.ts +290 -0
  76. package/src/cache.ts +37 -0
  77. package/src/cancellation.ts +136 -0
  78. package/src/charCode.ts +425 -0
  79. package/src/character-classifier.ts +82 -0
  80. package/src/const/encoding.ts +242 -0
  81. package/src/const/index.ts +1 -0
  82. package/src/date.ts +36 -0
  83. package/src/decorators.ts +166 -0
  84. package/src/disposable.ts +377 -0
  85. package/src/encoding.ts +278 -0
  86. package/src/errors.ts +192 -0
  87. package/src/event.ts +1024 -0
  88. package/src/file-uri.ts +41 -0
  89. package/src/filters.ts +887 -0
  90. package/src/functional.ts +43 -0
  91. package/src/glob.ts +752 -0
  92. package/src/hash.ts +336 -0
  93. package/src/iconLabels.ts +149 -0
  94. package/src/index.ts +40 -0
  95. package/src/iterator.ts +36 -0
  96. package/src/lifecycle.ts +48 -0
  97. package/src/linked-list.ts +144 -0
  98. package/src/linked-text.ts +55 -0
  99. package/src/lru-map.ts +133 -0
  100. package/src/map.ts +934 -0
  101. package/src/marshalling.ts +62 -0
  102. package/src/objects.ts +145 -0
  103. package/src/os.ts +76 -0
  104. package/src/path.ts +1885 -0
  105. package/src/platform.ts +194 -0
  106. package/src/process.ts +43 -0
  107. package/src/progress.ts +83 -0
  108. package/src/promises.ts +23 -0
  109. package/src/sequence.ts +28 -0
  110. package/src/strings.ts +1002 -0
  111. package/src/types.ts +214 -0
  112. package/src/uint.ts +59 -0
  113. package/src/uri.ts +298 -0
  114. package/src/uuid.ts +6 -0
package/src/types.ts ADDED
@@ -0,0 +1,214 @@
1
+ const _typeof = {
2
+ number: 'number',
3
+ string: 'string',
4
+ undefined: 'undefined',
5
+ object: 'object',
6
+ function: 'function',
7
+ };
8
+
9
+ /**
10
+ * @returns whether the provided parameter is a JavaScript Array or not.
11
+ */
12
+ export function isArray(array: any): array is any[] {
13
+ if (Array.isArray) {
14
+ return Array.isArray(array);
15
+ }
16
+
17
+ if (array && typeof array.length === _typeof.number && array.constructor === Array) {
18
+ return true;
19
+ }
20
+
21
+ return false;
22
+ }
23
+
24
+ /**
25
+ * @returns whether the provided parameter is a JavaScript String or not.
26
+ */
27
+ export function isString(str: any): str is string {
28
+ if (typeof str === _typeof.string || str instanceof String) {
29
+ return true;
30
+ }
31
+
32
+ return false;
33
+ }
34
+
35
+ /**
36
+ * @returns whether the provided parameter is a JavaScript Array and each element in the array is a string.
37
+ */
38
+ export function isStringArray(value: any): value is string[] {
39
+ return isArray(value) && value.every((elem) => isString(elem));
40
+ }
41
+
42
+ /**
43
+ *
44
+ * @returns whether the provided parameter is of type `object` but **not**
45
+ * `null`, an `array`, a `regexp`, nor a `date`.
46
+ */
47
+ export function isObject(obj: any): obj is Object {
48
+ // The method can't do a type cast since there are type (like strings) which
49
+ // are subclasses of any put not positvely matched by the function. Hence type
50
+ // narrowing results in wrong results.
51
+ return (
52
+ typeof obj === _typeof.object &&
53
+ obj !== null &&
54
+ !Array.isArray(obj) &&
55
+ !(obj instanceof RegExp) &&
56
+ !(obj instanceof Date)
57
+ );
58
+ }
59
+
60
+ /**
61
+ * In **contrast** to just checking `typeof` this will return `false` for `NaN`.
62
+ * @returns whether the provided parameter is a JavaScript Number or not.
63
+ */
64
+ export function isNumber(obj: any): obj is number {
65
+ if ((typeof obj === _typeof.number || obj instanceof Number) && !isNaN(obj)) {
66
+ return true;
67
+ }
68
+
69
+ return false;
70
+ }
71
+
72
+ /**
73
+ * @returns whether the provided parameter is a JavaScript Boolean or not.
74
+ */
75
+ export function isBoolean(obj: any): obj is boolean {
76
+ return obj === true || obj === false;
77
+ }
78
+
79
+ /**
80
+ * @returns whether the provided parameter is undefined.
81
+ */
82
+ export function isUndefined(obj: any): obj is undefined {
83
+ return typeof obj === _typeof.undefined;
84
+ }
85
+
86
+ /**
87
+ * @returns whether the provided parameter is defined.
88
+ */
89
+ export function isDefined<T>(arg: T | null | undefined): arg is T {
90
+ return !isUndefinedOrNull(arg);
91
+ }
92
+
93
+ /**
94
+ * @returns whether the provided parameter is undefined or null.
95
+ */
96
+ export function isUndefinedOrNull(obj: any): obj is undefined | null {
97
+ return isUndefined(obj) || obj === null;
98
+ }
99
+
100
+ /**
101
+ * @returns whether the provided parameter is null.
102
+ */
103
+ export function isNull(obj: any): obj is null {
104
+ return obj === null;
105
+ }
106
+
107
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
108
+
109
+ export function hasProperty<X extends {}, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown> {
110
+ return prop in obj;
111
+ }
112
+
113
+ /**
114
+ * @returns whether the provided parameter is an empty JavaScript Object or not.
115
+ */
116
+ export function isEmptyObject(obj: any): obj is any {
117
+ if (!isObject(obj)) {
118
+ return false;
119
+ }
120
+
121
+ for (const key in obj) {
122
+ if (hasOwnProperty.call(obj, key)) {
123
+ return false;
124
+ }
125
+ }
126
+
127
+ return true;
128
+ }
129
+
130
+ /**
131
+ * @returns whether the provided parameter is a JavaScript Function or not.
132
+ */
133
+ export function isFunction<T extends Function>(obj: any): obj is T {
134
+ return typeof obj === _typeof.function;
135
+ }
136
+
137
+ /**
138
+ * @returns whether the provided parameters is are JavaScript Function or not.
139
+ */
140
+ export function areFunctions(...objects: any[]): boolean {
141
+ return objects.length > 0 && objects.every(isFunction);
142
+ }
143
+
144
+ export type TypeConstraint = string | Function;
145
+
146
+ export function validateConstraints(args: any[], constraints: Array<TypeConstraint | undefined>): void {
147
+ const len = Math.min(args.length, constraints.length);
148
+ for (let i = 0; i < len; i++) {
149
+ validateConstraint(args[i], constraints[i]);
150
+ }
151
+ }
152
+
153
+ export function validateConstraint(arg: any, constraint: TypeConstraint | undefined): void {
154
+ if (isString(constraint)) {
155
+ if (typeof arg !== constraint) {
156
+ throw new Error(`argument does not match constraint: typeof ${constraint}`);
157
+ }
158
+ } else if (isFunction(constraint)) {
159
+ try {
160
+ if (arg instanceof constraint) {
161
+ return;
162
+ }
163
+ } catch (_e) {
164
+ // ignore
165
+ }
166
+ if (!isUndefinedOrNull(arg) && arg.constructor === constraint) {
167
+ return;
168
+ }
169
+ if (constraint.length === 1 && constraint.call(undefined, arg) === true) {
170
+ return;
171
+ }
172
+ throw new Error(
173
+ 'argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true',
174
+ );
175
+ }
176
+ }
177
+
178
+ /**
179
+ * 混入对象值
180
+ * @export
181
+ * @param {*} destination
182
+ * @param {*} source
183
+ * @param {boolean} [overwrite=true] 是否深度混入
184
+ * @returns {*}
185
+ */
186
+ export function mixin(destination: any, source: any, overwrite = true): any {
187
+ if (!isObject(destination)) {
188
+ return source;
189
+ }
190
+
191
+ if (isObject(source)) {
192
+ Object.keys(source).forEach((key) => {
193
+ if (key in destination) {
194
+ if (overwrite) {
195
+ if (isObject(destination[key]) && isObject(source[key])) {
196
+ mixin(destination[key], source[key], overwrite);
197
+ } else {
198
+ destination[key] = source[key];
199
+ }
200
+ }
201
+ } else {
202
+ destination[key] = source[key];
203
+ }
204
+ });
205
+ }
206
+ return destination;
207
+ }
208
+
209
+ /**
210
+ * Converts null to undefined, passes all other values through.
211
+ */
212
+ export function withNullAsUndefined<T>(x: T | null): T | undefined {
213
+ return x === null ? undefined : x;
214
+ }
package/src/uint.ts ADDED
@@ -0,0 +1,59 @@
1
+ /* ---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ export const enum Constants {
7
+ /**
8
+ * MAX SMI (SMall Integer) as defined in v8.
9
+ * one bit is lost for boxing/unboxing flag.
10
+ * one bit is lost for sign flag.
11
+ * See https://thibaultlaurens.github.io/javascript/2013/04/29/how-the-v8-engine-works/#tagged-values
12
+ */
13
+ MAX_SAFE_SMALL_INTEGER = 1 << 30,
14
+
15
+ /**
16
+ * MIN SMI (SMall Integer) as defined in v8.
17
+ * one bit is lost for boxing/unboxing flag.
18
+ * one bit is lost for sign flag.
19
+ * See https://thibaultlaurens.github.io/javascript/2013/04/29/how-the-v8-engine-works/#tagged-values
20
+ */
21
+ MIN_SAFE_SMALL_INTEGER = -(1 << 30),
22
+
23
+ /**
24
+ * Max unsigned integer that fits on 8 bits.
25
+ */
26
+ MAX_UINT_8 = 255, // 2^8 - 1
27
+
28
+ /**
29
+ * Max unsigned integer that fits on 16 bits.
30
+ */
31
+ MAX_UINT_16 = 65535, // 2^16 - 1
32
+
33
+ /**
34
+ * Max unsigned integer that fits on 32 bits.
35
+ */
36
+ MAX_UINT_32 = 4294967295, // 2^32 - 1
37
+
38
+ UNICODE_SUPPLEMENTARY_PLANE_BEGIN = 0x010000,
39
+ }
40
+
41
+ export function toUint8(v: number): number {
42
+ if (v < 0) {
43
+ return 0;
44
+ }
45
+ if (v > Constants.MAX_UINT_8) {
46
+ return Constants.MAX_UINT_8;
47
+ }
48
+ return v | 0;
49
+ }
50
+
51
+ export function toUint32(v: number): number {
52
+ if (v < 0) {
53
+ return 0;
54
+ }
55
+ if (v > Constants.MAX_UINT_32) {
56
+ return Constants.MAX_UINT_32;
57
+ }
58
+ return v | 0;
59
+ }
package/src/uri.ts ADDED
@@ -0,0 +1,298 @@
1
+ import { URI as Uri } from 'vscode-uri';
2
+
3
+ import { IRelativePattern, match } from './glob';
4
+ import { Path } from './path';
5
+
6
+ export { URI as Uri, Utils as UriUtils } from 'vscode-uri';
7
+ // 3.0 的 vscode-uri 没有导出这个
8
+ export interface UriComponents {
9
+ scheme: string;
10
+ authority: string;
11
+ path: string;
12
+ query: string;
13
+ fragment: string;
14
+ }
15
+
16
+ export class URI {
17
+ static from(components: { scheme: string; authority?: string; path?: string; query?: string; fragment?: string }) {
18
+ return new URI(Uri.from(components));
19
+ }
20
+
21
+ static file(path: string) {
22
+ return new URI(Uri.file(path));
23
+ }
24
+
25
+ static parse(path: string) {
26
+ return new URI(Uri.parse(path));
27
+ }
28
+
29
+ static isUri(thing: any): thing is URI {
30
+ if (thing instanceof URI) {
31
+ return true;
32
+ }
33
+ if (!thing) {
34
+ return false;
35
+ }
36
+ return Uri.isUri(thing);
37
+ }
38
+
39
+ static isUriString(str: string): boolean {
40
+ return !!str && /^[A-Za-z\-\_]+:\/\//.test(str);
41
+ }
42
+
43
+ static revive(data: any) {
44
+ return Uri.revive(data);
45
+ }
46
+
47
+ public readonly codeUri: Uri;
48
+ private _path: Path | undefined;
49
+
50
+ constructor(uri: string | Uri = '') {
51
+ if (Uri.isUri(uri)) {
52
+ this.codeUri = uri;
53
+ } else {
54
+ this.codeUri = Uri.parse(uri);
55
+ }
56
+ }
57
+
58
+ get displayName(): string {
59
+ const base = this.path.base;
60
+ if (base) {
61
+ return base;
62
+ }
63
+ if (this.path.isRoot) {
64
+ return this.path.toString();
65
+ }
66
+ return '';
67
+ }
68
+
69
+ /**
70
+ * Return all uri from the current to the top most.
71
+ */
72
+ get allLocations(): URI[] {
73
+ const locations: any[] = [];
74
+ let location: URI = this;
75
+ while (!location.path.isRoot) {
76
+ locations.push(location);
77
+ location = location.parent;
78
+ }
79
+ locations.push(location);
80
+ return locations;
81
+ }
82
+
83
+ get parent(): URI {
84
+ if (this.path.isRoot) {
85
+ return this;
86
+ }
87
+ return this.withPath(this.path.dir);
88
+ }
89
+
90
+ relative(uri: URI): Path | undefined {
91
+ if (this.authority !== uri.authority || this.scheme !== uri.scheme) {
92
+ return undefined;
93
+ }
94
+ return this.path.relative(uri.path);
95
+ }
96
+
97
+ resolve(path: string | Path): URI {
98
+ return this.withPath(this.path.join(path.toString()));
99
+ }
100
+
101
+ /**
102
+ * return a new URI replacing the current with the given scheme
103
+ */
104
+ withScheme(scheme: string): URI {
105
+ const newCodeUri = Uri.from({
106
+ ...this.codeUri.toJSON(),
107
+ scheme,
108
+ });
109
+ return new URI(newCodeUri);
110
+ }
111
+
112
+ /**
113
+ * @deprecated
114
+ * return this URI without a scheme
115
+ */
116
+ withoutScheme(): URI {
117
+ /**
118
+ * 本方法已废弃
119
+ * 由于 vscode-uri 自 1.0.8 起,内部强制校验和修正 `scheme` 参数
120
+ * 会将 scheme 为空时强制修正为 `file` (不可关闭)
121
+ * 会在不传入 scheme 时报错 (可通过 setUriThrowOnMissingScheme 关闭)
122
+ * 因此这里直接调用 `new Uri` 产生一个不带 scheme 的 Uri 实例
123
+ * ---- !!!!!!! ATTENTION ----
124
+ * 这样做的影响是 Uri 的实例 toJSON 时没有 $mid 参数,会在通信序列化时无法传输
125
+ * ---- !!!!!!! ATTENTION ----
126
+ * 但是 vscode-uri 对 constructor 属性加了 protected 保护,因此增加了 `ts-ignore`
127
+ */
128
+ if (process.env.NODE_ENV !== 'production' && console !== undefined) {
129
+ // eslint-disable-next-line no-console
130
+ console.warn(
131
+ 'Warning: `Uri.withoutScheme` is deprecated, ' +
132
+ 'If you want to get `fsPath` by `withoutScheme` method, ' +
133
+ "it's recommended to use `uri.path.toString` directly",
134
+ );
135
+ }
136
+
137
+ // @ts-ignore
138
+ const newCodeUri = new Uri({
139
+ ...this.codeUri.toJSON(),
140
+ scheme: '',
141
+ });
142
+
143
+ return new URI(newCodeUri);
144
+ }
145
+
146
+ /**
147
+ * return a new URI replacing the current with the given authority
148
+ */
149
+ withAuthority(authority: string): URI {
150
+ const newCodeUri = Uri.from({
151
+ ...this.codeUri.toJSON(),
152
+ scheme: this.codeUri.scheme,
153
+ authority,
154
+ });
155
+ return new URI(newCodeUri);
156
+ }
157
+
158
+ /**
159
+ * return this URI without a authority
160
+ */
161
+ withoutAuthority(): URI {
162
+ return this.withAuthority('');
163
+ }
164
+
165
+ /**
166
+ * return a new URI replacing the current with the given path
167
+ */
168
+ withPath(path: string | Path): URI {
169
+ const newCodeUri = Uri.from({
170
+ ...this.codeUri.toJSON(),
171
+ scheme: this.codeUri.scheme,
172
+ path: path.toString(),
173
+ });
174
+ return new URI(newCodeUri);
175
+ }
176
+
177
+ /**
178
+ * return this URI without a path
179
+ */
180
+ withoutPath(): URI {
181
+ return this.withPath('');
182
+ }
183
+
184
+ /**
185
+ * return a new URI replacing the current with the given query
186
+ */
187
+ withQuery(query: string): URI {
188
+ const newCodeUri = Uri.from({
189
+ ...this.codeUri.toJSON(),
190
+ scheme: this.codeUri.scheme,
191
+ query,
192
+ });
193
+ return new URI(newCodeUri);
194
+ }
195
+
196
+ /**
197
+ * return this URI without a query
198
+ */
199
+ withoutQuery(): URI {
200
+ return this.withQuery('');
201
+ }
202
+
203
+ /**
204
+ * return a new URI replacing the current with the given fragment
205
+ */
206
+ withFragment(fragment: string): URI {
207
+ const newCodeUri = Uri.from({
208
+ ...this.codeUri.toJSON(),
209
+ scheme: this.codeUri.scheme,
210
+ fragment,
211
+ });
212
+ return new URI(newCodeUri);
213
+ }
214
+
215
+ /**
216
+ * return this URI without a fragment
217
+ */
218
+ withoutFragment(): URI {
219
+ return this.withFragment('');
220
+ }
221
+
222
+ get scheme(): string {
223
+ return this.codeUri.scheme;
224
+ }
225
+
226
+ get authority(): string {
227
+ return this.codeUri.authority;
228
+ }
229
+
230
+ get path(): Path {
231
+ if (this._path === undefined) {
232
+ this._path = new Path(this.codeUri.path);
233
+ }
234
+ return this._path;
235
+ }
236
+
237
+ get query(): string {
238
+ return this.codeUri.query;
239
+ }
240
+
241
+ get fragment(): string {
242
+ return this.codeUri.fragment;
243
+ }
244
+
245
+ toString(skipEncoding?: boolean) {
246
+ return this.codeUri.toString(skipEncoding);
247
+ }
248
+
249
+ isEqualOrParent(uri: URI): boolean {
250
+ return this.authority === uri.authority && this.scheme === uri.scheme && this.path.isEqualOrParent(uri.path);
251
+ }
252
+
253
+ isEqual(uri: URI): boolean {
254
+ return (
255
+ this.authority === uri.authority &&
256
+ this.scheme === uri.scheme &&
257
+ this.path.isEqual(uri.path) &&
258
+ this.query === uri.query
259
+ );
260
+ }
261
+
262
+ matchGlobPattern(pattern: string | IRelativePattern): boolean {
263
+ return match(pattern, this.path.toString());
264
+ }
265
+
266
+ static getDistinctParents(uris: URI[]): URI[] {
267
+ const result: URI[] = [];
268
+ uris.forEach((uri, i) => {
269
+ if (!uris.some((otherUri, index) => index !== i && otherUri.isEqualOrParent(uri))) {
270
+ result.push(uri);
271
+ }
272
+ });
273
+ return result;
274
+ }
275
+
276
+ getParsedQuery(): { [key: string]: string } {
277
+ const queryString = this.query;
278
+ const query = {};
279
+ const pairs = (queryString[0] === '?' ? queryString.substr(1) : queryString).split('&');
280
+ // eslint-disable-next-line @typescript-eslint/prefer-for-of
281
+ for (let i = 0; i < pairs.length; i++) {
282
+ const pair = pairs[i].split('=');
283
+ query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '');
284
+ }
285
+ return query;
286
+ }
287
+
288
+ static stringifyQuery(query: { [key: string]: any }): string {
289
+ const values: string[] = [];
290
+ Object.keys(query).forEach((key) => {
291
+ const value = encodeURIComponent(query[key]);
292
+ if (value !== undefined) {
293
+ values.push(encodeURIComponent(key) + '=' + value);
294
+ }
295
+ });
296
+ return values.join('&');
297
+ }
298
+ }
package/src/uuid.ts ADDED
@@ -0,0 +1,6 @@
1
+ // @ts-ignore
2
+ import { nanoid } from 'nanoid';
3
+
4
+ export function uuid(size?: number): string {
5
+ return nanoid(size);
6
+ }