yummies 7.10.0 → 7.12.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/async.cjs +162 -48
- package/async.cjs.map +1 -1
- package/async.d.ts +112 -13
- package/async.js +163 -54
- package/async.js.map +1 -1
- package/chunk-CVq3Gv4J.cjs +50 -0
- package/chunk-YKewjYmz.js +37 -0
- package/common.cjs +48 -8
- package/common.cjs.map +1 -1
- package/common.d.ts +35 -2
- package/common.js +49 -11
- package/common.js.map +1 -1
- package/complex.cjs +275 -104
- package/complex.cjs.map +1 -1
- package/complex.d.ts +133 -13
- package/complex.js +275 -109
- package/complex.js.map +1 -1
- package/cookie.cjs +17 -7
- package/cookie.cjs.map +1 -1
- package/cookie.d.ts +8 -0
- package/cookie.js +18 -9
- package/cookie.js.map +1 -1
- package/css.cjs +147 -39
- package/css.cjs.map +1 -1
- package/css.d.ts +98 -6
- package/css.js +143 -41
- package/css.js.map +1 -1
- package/data.cjs +90 -55
- package/data.cjs.map +1 -1
- package/data.d.ts +32 -0
- package/data.js +91 -61
- package/data.js.map +1 -1
- package/date-time.cjs +578 -412
- package/date-time.cjs.map +1 -1
- package/date-time.d.ts +88 -0
- package/date-time.js +575 -421
- package/date-time.js.map +1 -1
- package/device.cjs +48 -23
- package/device.cjs.map +1 -1
- package/device.d.ts +32 -0
- package/device.js +49 -31
- package/device.js.map +1 -1
- package/encodings.cjs +275 -266
- package/encodings.cjs.map +1 -1
- package/encodings.d.ts +8 -0
- package/encodings.js +276 -268
- package/encodings.js.map +1 -1
- package/errors.cjs +20 -18
- package/errors.cjs.map +1 -1
- package/errors.js +19 -19
- package/errors.js.map +1 -1
- package/file.cjs +42 -24
- package/file.cjs.map +1 -1
- package/file.d.ts +16 -0
- package/file.js +43 -27
- package/file.js.map +1 -1
- package/format.cjs +125 -83
- package/format.cjs.map +1 -1
- package/format.d.ts +89 -4
- package/format.js +118 -82
- package/format.js.map +1 -1
- package/html.cjs +226 -137
- package/html.cjs.map +1 -1
- package/html.d.ts +67 -3
- package/html.js +223 -150
- package/html.js.map +1 -1
- package/id.cjs +74 -17
- package/id.cjs.map +1 -1
- package/id.d.ts +10 -10
- package/id.js +73 -24
- package/id.js.map +1 -1
- package/imports.cjs +41 -29
- package/imports.cjs.map +1 -1
- package/imports.d.ts +13 -4
- package/imports.js +40 -31
- package/imports.js.map +1 -1
- package/math.cjs +32 -6
- package/math.cjs.map +1 -1
- package/math.d.ts +17 -1
- package/math.js +33 -10
- package/math.js.map +1 -1
- package/media.cjs +275 -84
- package/media.cjs.map +1 -1
- package/media.d.ts +188 -2
- package/media.js +274 -93
- package/media.js.map +1 -1
- package/mobx.cjs +353 -193
- package/mobx.cjs.map +1 -1
- package/mobx.d.ts +172 -6
- package/mobx.js +351 -200
- package/mobx.js.map +1 -1
- package/ms.cjs +21 -10
- package/ms.cjs.map +1 -1
- package/ms.d.ts +1 -1
- package/ms.js +22 -13
- package/ms.js.map +1 -1
- package/number.cjs +13 -7
- package/number.cjs.map +1 -1
- package/number.js +14 -9
- package/number.js.map +1 -1
- package/package.json +13 -5
- package/parser.cjs +117 -64
- package/parser.cjs.map +1 -1
- package/parser.d.ts +63 -0
- package/parser.js +111 -64
- package/parser.js.map +1 -1
- package/price.cjs +24 -18
- package/price.cjs.map +1 -1
- package/price.d.ts +8 -0
- package/price.js +25 -20
- package/price.js.map +1 -1
- package/random.cjs +79 -13
- package/random.cjs.map +1 -1
- package/random.d.ts +64 -0
- package/random.js +80 -22
- package/random.js.map +1 -1
- package/react.cjs +673 -214
- package/react.cjs.map +1 -1
- package/react.d.ts +428 -9
- package/react.js +674 -239
- package/react.js.map +1 -1
- package/sound.cjs +14 -9
- package/sound.cjs.map +1 -1
- package/sound.d.ts +1 -1
- package/sound.js +15 -11
- package/sound.js.map +1 -1
- package/storage.cjs +49 -50
- package/storage.cjs.map +1 -1
- package/storage.d.ts +15 -6
- package/storage.js +50 -53
- package/storage.js.map +1 -1
- package/text.cjs +51 -34
- package/text.cjs.map +1 -1
- package/text.d.ts +5 -5
- package/text.js +52 -37
- package/text.js.map +1 -1
- package/type-guard.cjs +292 -72
- package/type-guard.cjs.map +1 -1
- package/type-guard.d.ts +199 -42
- package/type-guard.js +288 -73
- package/type-guard.js.map +1 -1
- package/types.cjs +0 -2
- package/types.global.cjs +0 -2
- package/types.global.js +0 -2
- package/types.js +0 -2
- package/vibrate.cjs +31 -6
- package/vibrate.cjs.map +1 -1
- package/vibrate.d.ts +23 -1
- package/vibrate.js +32 -8
- package/vibrate.js.map +1 -1
- package/types.cjs.map +0 -1
- package/types.global.cjs.map +0 -1
- package/types.global.js.map +0 -1
- package/types.js.map +0 -1
package/id.cjs
CHANGED
|
@@ -1,21 +1,77 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
require("./chunk-CVq3Gv4J.cjs");
|
|
3
|
+
let nanoid = require("nanoid");
|
|
4
|
+
//#region src/id.ts
|
|
5
|
+
var DIGITS = "0123456789";
|
|
6
|
+
var ALPHABET = `abcdefghijklmnopqrstuvwxyz${DIGITS}`;
|
|
7
|
+
/**
|
|
8
|
+
* Uses the alphabet `abcdefghijklmnopqrstuvwxyz0123456789`.
|
|
9
|
+
* Length: 6.
|
|
10
|
+
*/
|
|
11
|
+
var generateId = (0, nanoid.customAlphabet)(ALPHABET, 6);
|
|
12
|
+
/**
|
|
13
|
+
* Uses the alphabet `abcdefghijklmnopqrstuvwxyz0123456789`.
|
|
14
|
+
* Length: 4.
|
|
15
|
+
*/
|
|
16
|
+
var generateShortId = (0, nanoid.customAlphabet)(ALPHABET, 4);
|
|
17
|
+
/**
|
|
18
|
+
* Uses the alphabet `0123456789`.
|
|
19
|
+
* Length: 6.
|
|
20
|
+
*/
|
|
21
|
+
var generateNumericId = (0, nanoid.customAlphabet)(DIGITS, 6);
|
|
22
|
+
/**
|
|
23
|
+
* Uses the alphabet `0123456789`.
|
|
24
|
+
* Length: 4.
|
|
25
|
+
*/
|
|
26
|
+
var generateNumericShortId = (0, nanoid.customAlphabet)(DIGITS, 4);
|
|
27
|
+
/**
|
|
28
|
+
* Creates a function that generates unique strings based on call order.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* generateLinearNumericId = createLinearNumericIdGenerator(6);
|
|
33
|
+
* generateLinearNumericId() // '000000'
|
|
34
|
+
* generateLinearNumericId() // '000001'
|
|
35
|
+
* ...
|
|
36
|
+
* generateLinearNumericId() // '999999'
|
|
37
|
+
* generateLinearNumericId() // '1000000'
|
|
38
|
+
* ...
|
|
39
|
+
* generateLinearNumericId() // '9999999'
|
|
40
|
+
* generateLinearNumericId() // '10000000'
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @param size Minimum string length.
|
|
44
|
+
* @returns {()=>string}
|
|
45
|
+
*/
|
|
46
|
+
var createLinearNumericIdGenerator = (size = 9) => {
|
|
47
|
+
let lastCount = 0;
|
|
48
|
+
return () => {
|
|
49
|
+
return (lastCount++).toString().padStart(size, "0");
|
|
50
|
+
};
|
|
16
51
|
};
|
|
17
|
-
|
|
18
|
-
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* generateLinearNumericId() // '000000000'
|
|
57
|
+
* generateLinearNumericId() // '000000001'
|
|
58
|
+
* ...
|
|
59
|
+
* generateLinearNumericId() // '999999999'
|
|
60
|
+
* generateLinearNumericId() // '1000000000'
|
|
61
|
+
* ...
|
|
62
|
+
* generateLinearNumericId() // '9999999999'
|
|
63
|
+
* generateLinearNumericId() // '10000000000'
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
var generateLinearNumericId = createLinearNumericIdGenerator();
|
|
68
|
+
/**
|
|
69
|
+
* Is not recommended to use.
|
|
70
|
+
*
|
|
71
|
+
* Generates execution stack based pseudo-id (just sliced string from error stack)
|
|
72
|
+
*/
|
|
73
|
+
var generateStackBasedId = () => (/* @__PURE__ */ new Error()).stack.split("\n").slice(1, 4).join("");
|
|
74
|
+
//#endregion
|
|
19
75
|
exports.createLinearNumericIdGenerator = createLinearNumericIdGenerator;
|
|
20
76
|
exports.generateId = generateId;
|
|
21
77
|
exports.generateLinearNumericId = generateLinearNumericId;
|
|
@@ -23,4 +79,5 @@ exports.generateNumericId = generateNumericId;
|
|
|
23
79
|
exports.generateNumericShortId = generateNumericShortId;
|
|
24
80
|
exports.generateShortId = generateShortId;
|
|
25
81
|
exports.generateStackBasedId = generateStackBasedId;
|
|
26
|
-
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=id.cjs.map
|
package/id.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.cjs","sources":["../src/id.ts"],"sourcesContent":["import { customAlphabet } from 'nanoid';\n\nconst DIGITS = '0123456789';\nconst LATIN_CHARS = 'abcdefghijklmnopqrstuvwxyz';\n\nconst ALPHABET = `${LATIN_CHARS}${DIGITS}`;\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"id.cjs","names":[],"sources":["../src/id.ts"],"sourcesContent":["import { customAlphabet } from 'nanoid';\n\nconst DIGITS = '0123456789';\nconst LATIN_CHARS = 'abcdefghijklmnopqrstuvwxyz';\n\nconst ALPHABET = `${LATIN_CHARS}${DIGITS}`;\n\n/**\n * Uses the alphabet `abcdefghijklmnopqrstuvwxyz0123456789`.\n * Length: 6.\n */\nexport const generateId = customAlphabet(ALPHABET, 6);\n\n/**\n * Uses the alphabet `abcdefghijklmnopqrstuvwxyz0123456789`.\n * Length: 4.\n */\nexport const generateShortId = customAlphabet(ALPHABET, 4);\n\n/**\n * Uses the alphabet `0123456789`.\n * Length: 6.\n */\nexport const generateNumericId = customAlphabet(DIGITS, 6);\n\n/**\n * Uses the alphabet `0123456789`.\n * Length: 4.\n */\nexport const generateNumericShortId = customAlphabet(DIGITS, 4);\n\n/**\n * Creates a function that generates unique strings based on call order.\n *\n * @example\n * ```ts\n * generateLinearNumericId = createLinearNumericIdGenerator(6);\n * generateLinearNumericId() // '000000'\n * generateLinearNumericId() // '000001'\n * ...\n * generateLinearNumericId() // '999999'\n * generateLinearNumericId() // '1000000'\n * ...\n * generateLinearNumericId() // '9999999'\n * generateLinearNumericId() // '10000000'\n * ```\n *\n * @param size Minimum string length.\n * @returns {()=>string}\n */\nexport const createLinearNumericIdGenerator = (size: number = 9) => {\n let lastCount = 0;\n return () => {\n return (lastCount++).toString().padStart(size, '0');\n };\n};\n\n/**\n *\n * @example\n * ```ts\n * generateLinearNumericId() // '000000000'\n * generateLinearNumericId() // '000000001'\n * ...\n * generateLinearNumericId() // '999999999'\n * generateLinearNumericId() // '1000000000'\n * ...\n * generateLinearNumericId() // '9999999999'\n * generateLinearNumericId() // '10000000000'\n * ```\n *\n */\nexport const generateLinearNumericId = createLinearNumericIdGenerator();\n\n/**\n * Is not recommended to use.\n *\n * Generates execution stack based pseudo-id (just sliced string from error stack)\n */\nexport const generateStackBasedId = () =>\n new Error().stack!.split('\\n').slice(1, 4).join('');\n"],"mappings":";;;;AAEA,IAAM,SAAS;AAGf,IAAM,WAAW,6BAAiB;;;;;AAMlC,IAAa,cAAA,GAAA,OAAA,gBAA4B,UAAU,EAAE;;;;;AAMrD,IAAa,mBAAA,GAAA,OAAA,gBAAiC,UAAU,EAAE;;;;;AAM1D,IAAa,qBAAA,GAAA,OAAA,gBAAmC,QAAQ,EAAE;;;;;AAM1D,IAAa,0BAAA,GAAA,OAAA,gBAAwC,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;AAqB/D,IAAa,kCAAkC,OAAe,MAAM;CAClE,IAAI,YAAY;AAChB,cAAa;AACX,UAAQ,aAAa,UAAU,CAAC,SAAS,MAAM,IAAI;;;;;;;;;;;;;;;;;;AAmBvD,IAAa,0BAA0B,gCAAgC;;;;;;AAOvE,IAAa,8CACX,IAAI,OAAO,EAAC,MAAO,MAAM,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC,KAAK,GAAG"}
|
package/id.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Uses the alphabet `abcdefghijklmnopqrstuvwxyz0123456789`.
|
|
3
|
+
* Length: 6.
|
|
4
4
|
*/
|
|
5
5
|
declare const generateId: (size?: number) => string;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Uses the alphabet `abcdefghijklmnopqrstuvwxyz0123456789`.
|
|
8
|
+
* Length: 4.
|
|
9
9
|
*/
|
|
10
10
|
declare const generateShortId: (size?: number) => string;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* Uses the alphabet `0123456789`.
|
|
13
|
+
* Length: 6.
|
|
14
14
|
*/
|
|
15
15
|
declare const generateNumericId: (size?: number) => string;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* Uses the alphabet `0123456789`.
|
|
18
|
+
* Length: 4.
|
|
19
19
|
*/
|
|
20
20
|
declare const generateNumericShortId: (size?: number) => string;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Creates a function that generates unique strings based on call order.
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* ```ts
|
|
@@ -34,7 +34,7 @@ declare const generateNumericShortId: (size?: number) => string;
|
|
|
34
34
|
* generateLinearNumericId() // '10000000'
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
|
-
* @param size
|
|
37
|
+
* @param size Minimum string length.
|
|
38
38
|
* @returns {()=>string}
|
|
39
39
|
*/
|
|
40
40
|
declare const createLinearNumericIdGenerator: (size?: number) => () => string;
|
package/id.js
CHANGED
|
@@ -1,26 +1,75 @@
|
|
|
1
1
|
import { customAlphabet } from "nanoid";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
//#region src/id.ts
|
|
3
|
+
var DIGITS = "0123456789";
|
|
4
|
+
var ALPHABET = `abcdefghijklmnopqrstuvwxyz${DIGITS}`;
|
|
5
|
+
/**
|
|
6
|
+
* Uses the alphabet `abcdefghijklmnopqrstuvwxyz0123456789`.
|
|
7
|
+
* Length: 6.
|
|
8
|
+
*/
|
|
9
|
+
var generateId = customAlphabet(ALPHABET, 6);
|
|
10
|
+
/**
|
|
11
|
+
* Uses the alphabet `abcdefghijklmnopqrstuvwxyz0123456789`.
|
|
12
|
+
* Length: 4.
|
|
13
|
+
*/
|
|
14
|
+
var generateShortId = customAlphabet(ALPHABET, 4);
|
|
15
|
+
/**
|
|
16
|
+
* Uses the alphabet `0123456789`.
|
|
17
|
+
* Length: 6.
|
|
18
|
+
*/
|
|
19
|
+
var generateNumericId = customAlphabet(DIGITS, 6);
|
|
20
|
+
/**
|
|
21
|
+
* Uses the alphabet `0123456789`.
|
|
22
|
+
* Length: 4.
|
|
23
|
+
*/
|
|
24
|
+
var generateNumericShortId = customAlphabet(DIGITS, 4);
|
|
25
|
+
/**
|
|
26
|
+
* Creates a function that generates unique strings based on call order.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* generateLinearNumericId = createLinearNumericIdGenerator(6);
|
|
31
|
+
* generateLinearNumericId() // '000000'
|
|
32
|
+
* generateLinearNumericId() // '000001'
|
|
33
|
+
* ...
|
|
34
|
+
* generateLinearNumericId() // '999999'
|
|
35
|
+
* generateLinearNumericId() // '1000000'
|
|
36
|
+
* ...
|
|
37
|
+
* generateLinearNumericId() // '9999999'
|
|
38
|
+
* generateLinearNumericId() // '10000000'
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param size Minimum string length.
|
|
42
|
+
* @returns {()=>string}
|
|
43
|
+
*/
|
|
44
|
+
var createLinearNumericIdGenerator = (size = 9) => {
|
|
45
|
+
let lastCount = 0;
|
|
46
|
+
return () => {
|
|
47
|
+
return (lastCount++).toString().padStart(size, "0");
|
|
48
|
+
};
|
|
14
49
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* generateLinearNumericId() // '000000000'
|
|
55
|
+
* generateLinearNumericId() // '000000001'
|
|
56
|
+
* ...
|
|
57
|
+
* generateLinearNumericId() // '999999999'
|
|
58
|
+
* generateLinearNumericId() // '1000000000'
|
|
59
|
+
* ...
|
|
60
|
+
* generateLinearNumericId() // '9999999999'
|
|
61
|
+
* generateLinearNumericId() // '10000000000'
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
var generateLinearNumericId = createLinearNumericIdGenerator();
|
|
66
|
+
/**
|
|
67
|
+
* Is not recommended to use.
|
|
68
|
+
*
|
|
69
|
+
* Generates execution stack based pseudo-id (just sliced string from error stack)
|
|
70
|
+
*/
|
|
71
|
+
var generateStackBasedId = () => (/* @__PURE__ */ new Error()).stack.split("\n").slice(1, 4).join("");
|
|
72
|
+
//#endregion
|
|
73
|
+
export { createLinearNumericIdGenerator, generateId, generateLinearNumericId, generateNumericId, generateNumericShortId, generateShortId, generateStackBasedId };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=id.js.map
|
package/id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.js","sources":["../src/id.ts"],"sourcesContent":["import { customAlphabet } from 'nanoid';\n\nconst DIGITS = '0123456789';\nconst LATIN_CHARS = 'abcdefghijklmnopqrstuvwxyz';\n\nconst ALPHABET = `${LATIN_CHARS}${DIGITS}`;\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"id.js","names":[],"sources":["../src/id.ts"],"sourcesContent":["import { customAlphabet } from 'nanoid';\n\nconst DIGITS = '0123456789';\nconst LATIN_CHARS = 'abcdefghijklmnopqrstuvwxyz';\n\nconst ALPHABET = `${LATIN_CHARS}${DIGITS}`;\n\n/**\n * Uses the alphabet `abcdefghijklmnopqrstuvwxyz0123456789`.\n * Length: 6.\n */\nexport const generateId = customAlphabet(ALPHABET, 6);\n\n/**\n * Uses the alphabet `abcdefghijklmnopqrstuvwxyz0123456789`.\n * Length: 4.\n */\nexport const generateShortId = customAlphabet(ALPHABET, 4);\n\n/**\n * Uses the alphabet `0123456789`.\n * Length: 6.\n */\nexport const generateNumericId = customAlphabet(DIGITS, 6);\n\n/**\n * Uses the alphabet `0123456789`.\n * Length: 4.\n */\nexport const generateNumericShortId = customAlphabet(DIGITS, 4);\n\n/**\n * Creates a function that generates unique strings based on call order.\n *\n * @example\n * ```ts\n * generateLinearNumericId = createLinearNumericIdGenerator(6);\n * generateLinearNumericId() // '000000'\n * generateLinearNumericId() // '000001'\n * ...\n * generateLinearNumericId() // '999999'\n * generateLinearNumericId() // '1000000'\n * ...\n * generateLinearNumericId() // '9999999'\n * generateLinearNumericId() // '10000000'\n * ```\n *\n * @param size Minimum string length.\n * @returns {()=>string}\n */\nexport const createLinearNumericIdGenerator = (size: number = 9) => {\n let lastCount = 0;\n return () => {\n return (lastCount++).toString().padStart(size, '0');\n };\n};\n\n/**\n *\n * @example\n * ```ts\n * generateLinearNumericId() // '000000000'\n * generateLinearNumericId() // '000000001'\n * ...\n * generateLinearNumericId() // '999999999'\n * generateLinearNumericId() // '1000000000'\n * ...\n * generateLinearNumericId() // '9999999999'\n * generateLinearNumericId() // '10000000000'\n * ```\n *\n */\nexport const generateLinearNumericId = createLinearNumericIdGenerator();\n\n/**\n * Is not recommended to use.\n *\n * Generates execution stack based pseudo-id (just sliced string from error stack)\n */\nexport const generateStackBasedId = () =>\n new Error().stack!.split('\\n').slice(1, 4).join('');\n"],"mappings":";;AAEA,IAAM,SAAS;AAGf,IAAM,WAAW,6BAAiB;;;;;AAMlC,IAAa,aAAa,eAAe,UAAU,EAAE;;;;;AAMrD,IAAa,kBAAkB,eAAe,UAAU,EAAE;;;;;AAM1D,IAAa,oBAAoB,eAAe,QAAQ,EAAE;;;;;AAM1D,IAAa,yBAAyB,eAAe,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;AAqB/D,IAAa,kCAAkC,OAAe,MAAM;CAClE,IAAI,YAAY;AAChB,cAAa;AACX,UAAQ,aAAa,UAAU,CAAC,SAAS,MAAM,IAAI;;;;;;;;;;;;;;;;;;AAmBvD,IAAa,0BAA0B,gCAAgC;;;;;;AAOvE,IAAa,8CACX,IAAI,OAAO,EAAC,MAAO,MAAM,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC,KAAK,GAAG"}
|
package/imports.cjs
CHANGED
|
@@ -1,34 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
require("./chunk-CVq3Gv4J.cjs");
|
|
3
|
+
let yummies_async = require("yummies/async");
|
|
4
|
+
//#region src/imports.ts
|
|
5
|
+
/**
|
|
6
|
+
* Lazily loads a module with retry support.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* fetchLazyModule(() => import('./test.ts'), 3) // starts loading test.ts
|
|
11
|
+
* // If loading test.ts fails, fetchLazyModule retries by calling fetchModule() again
|
|
12
|
+
* // It retries as many times as specified by attempts (3 by default)
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
var fetchLazyModule = async (fetchModule, attempts = 3, delay = 1e3) => {
|
|
16
|
+
const attemptsArray = Array.from({ length: attempts }).fill(fetchModule);
|
|
17
|
+
let lastError = null;
|
|
18
|
+
for await (const attempt of attemptsArray) try {
|
|
19
|
+
if (lastError !== null) await (0, yummies_async.sleep)(delay);
|
|
20
|
+
return await attempt();
|
|
21
|
+
} catch (error) {
|
|
22
|
+
lastError = error;
|
|
23
|
+
}
|
|
24
|
+
throw lastError;
|
|
20
25
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Resolves either a direct value or an asynchronously imported module and unwraps its `default` export.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const component = await unpackAsyncModule(import('./Component.ts'));
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
var unpackAsyncModule = async (maybeModule) => {
|
|
35
|
+
if (maybeModule instanceof Promise) {
|
|
36
|
+
const data = await maybeModule;
|
|
37
|
+
if (data.default) return data.default;
|
|
38
|
+
else return data;
|
|
39
|
+
}
|
|
40
|
+
return maybeModule;
|
|
31
41
|
};
|
|
42
|
+
//#endregion
|
|
32
43
|
exports.fetchLazyModule = fetchLazyModule;
|
|
33
44
|
exports.unpackAsyncModule = unpackAsyncModule;
|
|
34
|
-
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=imports.cjs.map
|
package/imports.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.cjs","sources":["../src/imports.ts"],"sourcesContent":["import { sleep } from 'yummies/async';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"imports.cjs","names":[],"sources":["../src/imports.ts"],"sourcesContent":["import { sleep } from 'yummies/async';\n\n/**\n * Lazily loads a module with retry support.\n *\n * @example\n * ```ts\n * fetchLazyModule(() => import('./test.ts'), 3) // starts loading test.ts\n * // If loading test.ts fails, fetchLazyModule retries by calling fetchModule() again\n * // It retries as many times as specified by attempts (3 by default)\n * ```\n */\nexport const fetchLazyModule = async <T>(\n fetchModule: () => Promise<T>,\n attempts = 3,\n delay = 1000,\n): Promise<T> => {\n const attemptsArray = Array.from<typeof fetchModule>({\n length: attempts,\n }).fill(fetchModule);\n\n let lastError: null | Error = null;\n\n for await (const attempt of attemptsArray) {\n try {\n if (lastError !== null) {\n await sleep(delay);\n }\n return await attempt();\n } catch (error) {\n lastError = error as Error;\n }\n }\n throw lastError;\n};\n\nexport type PackedAsyncModule<T> = Promise<T | { default: T }>;\n\n/**\n * Resolves either a direct value or an asynchronously imported module and unwraps its `default` export.\n *\n * @example\n * ```ts\n * const component = await unpackAsyncModule(import('./Component.ts'));\n * ```\n */\nexport const unpackAsyncModule = async <T>(\n maybeModule: T | PackedAsyncModule<T>,\n): Promise<T> => {\n if (maybeModule instanceof Promise) {\n const data = (await maybeModule) as any;\n\n if ((data as any).default) {\n return (data as any).default;\n } else {\n return data;\n }\n }\n\n return maybeModule;\n};\n"],"mappings":";;;;;;;;;;;;;;AAYA,IAAa,kBAAkB,OAC7B,aACA,WAAW,GACX,QAAQ,QACO;CACf,MAAM,gBAAgB,MAAM,KAAyB,EACnD,QAAQ,UACT,CAAC,CAAC,KAAK,YAAY;CAEpB,IAAI,YAA0B;AAE9B,YAAW,MAAM,WAAW,cAC1B,KAAI;AACF,MAAI,cAAc,KAChB,QAAA,GAAA,cAAA,OAAY,MAAM;AAEpB,SAAO,MAAM,SAAS;UACf,OAAO;AACd,cAAY;;AAGhB,OAAM;;;;;;;;;;AAaR,IAAa,oBAAoB,OAC/B,gBACe;AACf,KAAI,uBAAuB,SAAS;EAClC,MAAM,OAAQ,MAAM;AAEpB,MAAK,KAAa,QAChB,QAAQ,KAAa;MAErB,QAAO;;AAIX,QAAO"}
|
package/imports.d.ts
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Lazily loads a module with retry support.
|
|
3
|
+
*
|
|
3
4
|
* @example
|
|
4
5
|
* ```ts
|
|
5
|
-
* fetchLazyModule(() => import(
|
|
6
|
-
* //
|
|
7
|
-
* //
|
|
6
|
+
* fetchLazyModule(() => import('./test.ts'), 3) // starts loading test.ts
|
|
7
|
+
* // If loading test.ts fails, fetchLazyModule retries by calling fetchModule() again
|
|
8
|
+
* // It retries as many times as specified by attempts (3 by default)
|
|
8
9
|
* ```
|
|
9
10
|
*/
|
|
10
11
|
declare const fetchLazyModule: <T>(fetchModule: () => Promise<T>, attempts?: number, delay?: number) => Promise<T>;
|
|
11
12
|
type PackedAsyncModule<T> = Promise<T | {
|
|
12
13
|
default: T;
|
|
13
14
|
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Resolves either a direct value or an asynchronously imported module and unwraps its `default` export.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const component = await unpackAsyncModule(import('./Component.ts'));
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
14
23
|
declare const unpackAsyncModule: <T>(maybeModule: T | PackedAsyncModule<T>) => Promise<T>;
|
|
15
24
|
|
|
16
25
|
export { fetchLazyModule, unpackAsyncModule };
|
package/imports.js
CHANGED
|
@@ -1,34 +1,43 @@
|
|
|
1
1
|
import { sleep } from "yummies/async";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
//#region src/imports.ts
|
|
3
|
+
/**
|
|
4
|
+
* Lazily loads a module with retry support.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* fetchLazyModule(() => import('./test.ts'), 3) // starts loading test.ts
|
|
9
|
+
* // If loading test.ts fails, fetchLazyModule retries by calling fetchModule() again
|
|
10
|
+
* // It retries as many times as specified by attempts (3 by default)
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
var fetchLazyModule = async (fetchModule, attempts = 3, delay = 1e3) => {
|
|
14
|
+
const attemptsArray = Array.from({ length: attempts }).fill(fetchModule);
|
|
15
|
+
let lastError = null;
|
|
16
|
+
for await (const attempt of attemptsArray) try {
|
|
17
|
+
if (lastError !== null) await sleep(delay);
|
|
18
|
+
return await attempt();
|
|
19
|
+
} catch (error) {
|
|
20
|
+
lastError = error;
|
|
21
|
+
}
|
|
22
|
+
throw lastError;
|
|
18
23
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Resolves either a direct value or an asynchronously imported module and unwraps its `default` export.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const component = await unpackAsyncModule(import('./Component.ts'));
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
var unpackAsyncModule = async (maybeModule) => {
|
|
33
|
+
if (maybeModule instanceof Promise) {
|
|
34
|
+
const data = await maybeModule;
|
|
35
|
+
if (data.default) return data.default;
|
|
36
|
+
else return data;
|
|
37
|
+
}
|
|
38
|
+
return maybeModule;
|
|
29
39
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
//# sourceMappingURL=imports.js.map
|
|
40
|
+
//#endregion
|
|
41
|
+
export { fetchLazyModule, unpackAsyncModule };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=imports.js.map
|
package/imports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.js","sources":["../src/imports.ts"],"sourcesContent":["import { sleep } from 'yummies/async';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"imports.js","names":[],"sources":["../src/imports.ts"],"sourcesContent":["import { sleep } from 'yummies/async';\n\n/**\n * Lazily loads a module with retry support.\n *\n * @example\n * ```ts\n * fetchLazyModule(() => import('./test.ts'), 3) // starts loading test.ts\n * // If loading test.ts fails, fetchLazyModule retries by calling fetchModule() again\n * // It retries as many times as specified by attempts (3 by default)\n * ```\n */\nexport const fetchLazyModule = async <T>(\n fetchModule: () => Promise<T>,\n attempts = 3,\n delay = 1000,\n): Promise<T> => {\n const attemptsArray = Array.from<typeof fetchModule>({\n length: attempts,\n }).fill(fetchModule);\n\n let lastError: null | Error = null;\n\n for await (const attempt of attemptsArray) {\n try {\n if (lastError !== null) {\n await sleep(delay);\n }\n return await attempt();\n } catch (error) {\n lastError = error as Error;\n }\n }\n throw lastError;\n};\n\nexport type PackedAsyncModule<T> = Promise<T | { default: T }>;\n\n/**\n * Resolves either a direct value or an asynchronously imported module and unwraps its `default` export.\n *\n * @example\n * ```ts\n * const component = await unpackAsyncModule(import('./Component.ts'));\n * ```\n */\nexport const unpackAsyncModule = async <T>(\n maybeModule: T | PackedAsyncModule<T>,\n): Promise<T> => {\n if (maybeModule instanceof Promise) {\n const data = (await maybeModule) as any;\n\n if ((data as any).default) {\n return (data as any).default;\n } else {\n return data;\n }\n }\n\n return maybeModule;\n};\n"],"mappings":";;;;;;;;;;;;AAYA,IAAa,kBAAkB,OAC7B,aACA,WAAW,GACX,QAAQ,QACO;CACf,MAAM,gBAAgB,MAAM,KAAyB,EACnD,QAAQ,UACT,CAAC,CAAC,KAAK,YAAY;CAEpB,IAAI,YAA0B;AAE9B,YAAW,MAAM,WAAW,cAC1B,KAAI;AACF,MAAI,cAAc,KAChB,OAAM,MAAM,MAAM;AAEpB,SAAO,MAAM,SAAS;UACf,OAAO;AACd,cAAY;;AAGhB,OAAM;;;;;;;;;;AAaR,IAAa,oBAAoB,OAC/B,gBACe;AACf,KAAI,uBAAuB,SAAS;EAClC,MAAM,OAAQ,MAAM;AAEpB,MAAK,KAAa,QAChB,QAAQ,KAAa;MAErB,QAAO;;AAIX,QAAO"}
|
package/math.cjs
CHANGED
|
@@ -1,15 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/math.ts
|
|
3
|
+
/**
|
|
4
|
+
* Converts degrees to radians.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* degToRad(180); // Math.PI
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
3
11
|
function degToRad(deg) {
|
|
4
|
-
|
|
12
|
+
return deg * (Math.PI / 180);
|
|
5
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Converts radians to degrees.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* radToDeg(Math.PI); // 180
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
6
22
|
function radToDeg(rad) {
|
|
7
|
-
|
|
23
|
+
return rad * (180 / Math.PI);
|
|
8
24
|
}
|
|
9
|
-
|
|
10
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Returns what percentage `value` is of `from`.
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* percentFrom(500, 2000) // 25
|
|
30
|
+
* percentFrom(1000, 2000) // 50
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
var percentFrom = (value, from) => {
|
|
34
|
+
return (value ?? 0) / (from ?? 0) * 100 || 0;
|
|
11
35
|
};
|
|
36
|
+
//#endregion
|
|
12
37
|
exports.degToRad = degToRad;
|
|
13
38
|
exports.percentFrom = percentFrom;
|
|
14
39
|
exports.radToDeg = radToDeg;
|
|
15
|
-
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=math.cjs.map
|
package/math.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.cjs","sources":["../src/math.ts"],"sourcesContent":["import type { Maybe } from 'yummies/types';\n\nexport function degToRad(deg: number) {\n return deg * (Math.PI / 180);\n}\nexport function radToDeg(rad: number) {\n return rad * (180 / Math.PI);\n}\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"math.cjs","names":[],"sources":["../src/math.ts"],"sourcesContent":["import type { Maybe } from 'yummies/types';\n\n/**\n * Converts degrees to radians.\n *\n * @example\n * ```ts\n * degToRad(180); // Math.PI\n * ```\n */\nexport function degToRad(deg: number) {\n return deg * (Math.PI / 180);\n}\n\n/**\n * Converts radians to degrees.\n *\n * @example\n * ```ts\n * radToDeg(Math.PI); // 180\n * ```\n */\nexport function radToDeg(rad: number) {\n return rad * (180 / Math.PI);\n}\n\n/**\n * Returns what percentage `value` is of `from`.\n * @example\n * ```ts\n * percentFrom(500, 2000) // 25\n * percentFrom(1000, 2000) // 50\n * ```\n */\nexport const percentFrom = (value: Maybe<number>, from: Maybe<number>) => {\n return ((value ?? 0) / (from ?? 0)) * 100 || 0;\n};\n"],"mappings":";;;;;;;;;;AAUA,SAAgB,SAAS,KAAa;AACpC,QAAO,OAAO,KAAK,KAAK;;;;;;;;;;AAW1B,SAAgB,SAAS,KAAa;AACpC,QAAO,OAAO,MAAM,KAAK;;;;;;;;;;AAW3B,IAAa,eAAe,OAAsB,SAAwB;AACxE,SAAS,SAAS,MAAM,QAAQ,KAAM,OAAO"}
|
package/math.d.ts
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import { Maybe } from 'yummies/types';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Converts degrees to radians.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* degToRad(180); // Math.PI
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
3
11
|
declare function degToRad(deg: number): number;
|
|
12
|
+
/**
|
|
13
|
+
* Converts radians to degrees.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* radToDeg(Math.PI); // 180
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
4
20
|
declare function radToDeg(rad: number): number;
|
|
5
21
|
/**
|
|
6
|
-
*
|
|
22
|
+
* Returns what percentage `value` is of `from`.
|
|
7
23
|
* @example
|
|
8
24
|
* ```ts
|
|
9
25
|
* percentFrom(500, 2000) // 25
|
package/math.js
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
|
+
//#region src/math.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts degrees to radians.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* degToRad(180); // Math.PI
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
1
10
|
function degToRad(deg) {
|
|
2
|
-
|
|
11
|
+
return deg * (Math.PI / 180);
|
|
3
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Converts radians to degrees.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* radToDeg(Math.PI); // 180
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
4
21
|
function radToDeg(rad) {
|
|
5
|
-
|
|
22
|
+
return rad * (180 / Math.PI);
|
|
6
23
|
}
|
|
7
|
-
|
|
8
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Returns what percentage `value` is of `from`.
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* percentFrom(500, 2000) // 25
|
|
29
|
+
* percentFrom(1000, 2000) // 50
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
var percentFrom = (value, from) => {
|
|
33
|
+
return (value ?? 0) / (from ?? 0) * 100 || 0;
|
|
9
34
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=math.js.map
|
|
35
|
+
//#endregion
|
|
36
|
+
export { degToRad, percentFrom, radToDeg };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=math.js.map
|
package/math.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.js","sources":["../src/math.ts"],"sourcesContent":["import type { Maybe } from 'yummies/types';\n\nexport function degToRad(deg: number) {\n return deg * (Math.PI / 180);\n}\nexport function radToDeg(rad: number) {\n return rad * (180 / Math.PI);\n}\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"math.js","names":[],"sources":["../src/math.ts"],"sourcesContent":["import type { Maybe } from 'yummies/types';\n\n/**\n * Converts degrees to radians.\n *\n * @example\n * ```ts\n * degToRad(180); // Math.PI\n * ```\n */\nexport function degToRad(deg: number) {\n return deg * (Math.PI / 180);\n}\n\n/**\n * Converts radians to degrees.\n *\n * @example\n * ```ts\n * radToDeg(Math.PI); // 180\n * ```\n */\nexport function radToDeg(rad: number) {\n return rad * (180 / Math.PI);\n}\n\n/**\n * Returns what percentage `value` is of `from`.\n * @example\n * ```ts\n * percentFrom(500, 2000) // 25\n * percentFrom(1000, 2000) // 50\n * ```\n */\nexport const percentFrom = (value: Maybe<number>, from: Maybe<number>) => {\n return ((value ?? 0) / (from ?? 0)) * 100 || 0;\n};\n"],"mappings":";;;;;;;;;AAUA,SAAgB,SAAS,KAAa;AACpC,QAAO,OAAO,KAAK,KAAK;;;;;;;;;;AAW1B,SAAgB,SAAS,KAAa;AACpC,QAAO,OAAO,MAAM,KAAK;;;;;;;;;;AAW3B,IAAa,eAAe,OAAsB,SAAwB;AACxE,SAAS,SAAS,MAAM,QAAQ,KAAM,OAAO"}
|