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.
Files changed (154) hide show
  1. package/async.cjs +162 -48
  2. package/async.cjs.map +1 -1
  3. package/async.d.ts +112 -13
  4. package/async.js +163 -54
  5. package/async.js.map +1 -1
  6. package/chunk-CVq3Gv4J.cjs +50 -0
  7. package/chunk-YKewjYmz.js +37 -0
  8. package/common.cjs +48 -8
  9. package/common.cjs.map +1 -1
  10. package/common.d.ts +35 -2
  11. package/common.js +49 -11
  12. package/common.js.map +1 -1
  13. package/complex.cjs +275 -104
  14. package/complex.cjs.map +1 -1
  15. package/complex.d.ts +133 -13
  16. package/complex.js +275 -109
  17. package/complex.js.map +1 -1
  18. package/cookie.cjs +17 -7
  19. package/cookie.cjs.map +1 -1
  20. package/cookie.d.ts +8 -0
  21. package/cookie.js +18 -9
  22. package/cookie.js.map +1 -1
  23. package/css.cjs +147 -39
  24. package/css.cjs.map +1 -1
  25. package/css.d.ts +98 -6
  26. package/css.js +143 -41
  27. package/css.js.map +1 -1
  28. package/data.cjs +90 -55
  29. package/data.cjs.map +1 -1
  30. package/data.d.ts +32 -0
  31. package/data.js +91 -61
  32. package/data.js.map +1 -1
  33. package/date-time.cjs +578 -412
  34. package/date-time.cjs.map +1 -1
  35. package/date-time.d.ts +88 -0
  36. package/date-time.js +575 -421
  37. package/date-time.js.map +1 -1
  38. package/device.cjs +48 -23
  39. package/device.cjs.map +1 -1
  40. package/device.d.ts +32 -0
  41. package/device.js +49 -31
  42. package/device.js.map +1 -1
  43. package/encodings.cjs +275 -266
  44. package/encodings.cjs.map +1 -1
  45. package/encodings.d.ts +8 -0
  46. package/encodings.js +276 -268
  47. package/encodings.js.map +1 -1
  48. package/errors.cjs +20 -18
  49. package/errors.cjs.map +1 -1
  50. package/errors.js +19 -19
  51. package/errors.js.map +1 -1
  52. package/file.cjs +42 -24
  53. package/file.cjs.map +1 -1
  54. package/file.d.ts +16 -0
  55. package/file.js +43 -27
  56. package/file.js.map +1 -1
  57. package/format.cjs +125 -83
  58. package/format.cjs.map +1 -1
  59. package/format.d.ts +89 -4
  60. package/format.js +118 -82
  61. package/format.js.map +1 -1
  62. package/html.cjs +226 -137
  63. package/html.cjs.map +1 -1
  64. package/html.d.ts +67 -3
  65. package/html.js +223 -150
  66. package/html.js.map +1 -1
  67. package/id.cjs +74 -17
  68. package/id.cjs.map +1 -1
  69. package/id.d.ts +10 -10
  70. package/id.js +73 -24
  71. package/id.js.map +1 -1
  72. package/imports.cjs +41 -29
  73. package/imports.cjs.map +1 -1
  74. package/imports.d.ts +13 -4
  75. package/imports.js +40 -31
  76. package/imports.js.map +1 -1
  77. package/math.cjs +32 -6
  78. package/math.cjs.map +1 -1
  79. package/math.d.ts +17 -1
  80. package/math.js +33 -10
  81. package/math.js.map +1 -1
  82. package/media.cjs +275 -84
  83. package/media.cjs.map +1 -1
  84. package/media.d.ts +188 -2
  85. package/media.js +274 -93
  86. package/media.js.map +1 -1
  87. package/mobx.cjs +353 -193
  88. package/mobx.cjs.map +1 -1
  89. package/mobx.d.ts +172 -6
  90. package/mobx.js +351 -200
  91. package/mobx.js.map +1 -1
  92. package/ms.cjs +21 -10
  93. package/ms.cjs.map +1 -1
  94. package/ms.d.ts +1 -1
  95. package/ms.js +22 -13
  96. package/ms.js.map +1 -1
  97. package/number.cjs +13 -7
  98. package/number.cjs.map +1 -1
  99. package/number.js +14 -9
  100. package/number.js.map +1 -1
  101. package/package.json +13 -5
  102. package/parser.cjs +117 -64
  103. package/parser.cjs.map +1 -1
  104. package/parser.d.ts +63 -0
  105. package/parser.js +111 -64
  106. package/parser.js.map +1 -1
  107. package/price.cjs +24 -18
  108. package/price.cjs.map +1 -1
  109. package/price.d.ts +8 -0
  110. package/price.js +25 -20
  111. package/price.js.map +1 -1
  112. package/random.cjs +79 -13
  113. package/random.cjs.map +1 -1
  114. package/random.d.ts +64 -0
  115. package/random.js +80 -22
  116. package/random.js.map +1 -1
  117. package/react.cjs +673 -214
  118. package/react.cjs.map +1 -1
  119. package/react.d.ts +428 -9
  120. package/react.js +674 -239
  121. package/react.js.map +1 -1
  122. package/sound.cjs +14 -9
  123. package/sound.cjs.map +1 -1
  124. package/sound.d.ts +1 -1
  125. package/sound.js +15 -11
  126. package/sound.js.map +1 -1
  127. package/storage.cjs +49 -50
  128. package/storage.cjs.map +1 -1
  129. package/storage.d.ts +15 -6
  130. package/storage.js +50 -53
  131. package/storage.js.map +1 -1
  132. package/text.cjs +51 -34
  133. package/text.cjs.map +1 -1
  134. package/text.d.ts +5 -5
  135. package/text.js +52 -37
  136. package/text.js.map +1 -1
  137. package/type-guard.cjs +292 -72
  138. package/type-guard.cjs.map +1 -1
  139. package/type-guard.d.ts +199 -42
  140. package/type-guard.js +288 -73
  141. package/type-guard.js.map +1 -1
  142. package/types.cjs +0 -2
  143. package/types.global.cjs +0 -2
  144. package/types.global.js +0 -2
  145. package/types.js +0 -2
  146. package/vibrate.cjs +31 -6
  147. package/vibrate.cjs.map +1 -1
  148. package/vibrate.d.ts +23 -1
  149. package/vibrate.js +32 -8
  150. package/vibrate.js.map +1 -1
  151. package/types.cjs.map +0 -1
  152. package/types.global.cjs.map +0 -1
  153. package/types.global.js.map +0 -1
  154. 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
- const nanoid = require("nanoid");
4
- const DIGITS = "0123456789";
5
- const LATIN_CHARS = "abcdefghijklmnopqrstuvwxyz";
6
- const ALPHABET = `${LATIN_CHARS}${DIGITS}`;
7
- const generateId = nanoid.customAlphabet(ALPHABET, 6);
8
- const generateShortId = nanoid.customAlphabet(ALPHABET, 4);
9
- const generateNumericId = nanoid.customAlphabet(DIGITS, 6);
10
- const generateNumericShortId = nanoid.customAlphabet(DIGITS, 4);
11
- const createLinearNumericIdGenerator = (size = 9) => {
12
- let lastCount = 0;
13
- return () => {
14
- return (lastCount++).toString().padStart(size, "0");
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
- const generateLinearNumericId = createLinearNumericIdGenerator();
18
- const generateStackBasedId = () => new Error().stack.split("\n").slice(1, 4).join("");
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
- //# sourceMappingURL=id.cjs.map
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 * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789\n * Размер 6\n */\nexport const generateId = customAlphabet(ALPHABET, 6);\n\n/**\n * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789\n * Размер 4\n */\nexport const generateShortId = customAlphabet(ALPHABET, 4);\n\n/**\n * Использует алфавит 0123456789\n * Размер 6\n */\nexport const generateNumericId = customAlphabet(DIGITS, 6);\n\n/**\n * Использует алфавит 0123456789\n * Размер 4\n */\nexport const generateNumericShortId = customAlphabet(DIGITS, 4);\n\n/**\n * Создает функцию, которая будет создавать уникальную строку, уникальность которой основана на порядке вызова этой функции\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 размер\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"],"names":["customAlphabet"],"mappings":";;;AAEA,MAAM,SAAS;AACf,MAAM,cAAc;AAEpB,MAAM,WAAW,GAAG,WAAW,GAAG,MAAM;AAMjC,MAAM,aAAaA,OAAAA,eAAe,UAAU,CAAC;AAM7C,MAAM,kBAAkBA,OAAAA,eAAe,UAAU,CAAC;AAMlD,MAAM,oBAAoBA,OAAAA,eAAe,QAAQ,CAAC;AAMlD,MAAM,yBAAyBA,OAAAA,eAAe,QAAQ,CAAC;AAqBvD,MAAM,iCAAiC,CAAC,OAAe,MAAM;AAClE,MAAI,YAAY;AAChB,SAAO,MAAM;AACX,YAAQ,aAAa,SAAA,EAAW,SAAS,MAAM,GAAG;AAAA,EACpD;AACF;AAiBO,MAAM,0BAA0B,+BAAA;AAOhC,MAAM,uBAAuB,MAClC,IAAI,MAAA,EAAQ,MAAO,MAAM,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE;;;;;;;;"}
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
- * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
3
- * Размер 6
2
+ * Uses the alphabet `abcdefghijklmnopqrstuvwxyz0123456789`.
3
+ * Length: 6.
4
4
  */
5
5
  declare const generateId: (size?: number) => string;
6
6
  /**
7
- * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
8
- * Размер 4
7
+ * Uses the alphabet `abcdefghijklmnopqrstuvwxyz0123456789`.
8
+ * Length: 4.
9
9
  */
10
10
  declare const generateShortId: (size?: number) => string;
11
11
  /**
12
- * Использует алфавит 0123456789
13
- * Размер 6
12
+ * Uses the alphabet `0123456789`.
13
+ * Length: 6.
14
14
  */
15
15
  declare const generateNumericId: (size?: number) => string;
16
16
  /**
17
- * Использует алфавит 0123456789
18
- * Размер 4
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
- const DIGITS = "0123456789";
3
- const LATIN_CHARS = "abcdefghijklmnopqrstuvwxyz";
4
- const ALPHABET = `${LATIN_CHARS}${DIGITS}`;
5
- const generateId = customAlphabet(ALPHABET, 6);
6
- const generateShortId = customAlphabet(ALPHABET, 4);
7
- const generateNumericId = customAlphabet(DIGITS, 6);
8
- const generateNumericShortId = customAlphabet(DIGITS, 4);
9
- const createLinearNumericIdGenerator = (size = 9) => {
10
- let lastCount = 0;
11
- return () => {
12
- return (lastCount++).toString().padStart(size, "0");
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
- const generateLinearNumericId = createLinearNumericIdGenerator();
16
- const generateStackBasedId = () => new Error().stack.split("\n").slice(1, 4).join("");
17
- export {
18
- createLinearNumericIdGenerator,
19
- generateId,
20
- generateLinearNumericId,
21
- generateNumericId,
22
- generateNumericShortId,
23
- generateShortId,
24
- generateStackBasedId
25
- };
26
- //# sourceMappingURL=id.js.map
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 * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789\n * Размер 6\n */\nexport const generateId = customAlphabet(ALPHABET, 6);\n\n/**\n * Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789\n * Размер 4\n */\nexport const generateShortId = customAlphabet(ALPHABET, 4);\n\n/**\n * Использует алфавит 0123456789\n * Размер 6\n */\nexport const generateNumericId = customAlphabet(DIGITS, 6);\n\n/**\n * Использует алфавит 0123456789\n * Размер 4\n */\nexport const generateNumericShortId = customAlphabet(DIGITS, 4);\n\n/**\n * Создает функцию, которая будет создавать уникальную строку, уникальность которой основана на порядке вызова этой функции\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 размер\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"],"names":[],"mappings":";AAEA,MAAM,SAAS;AACf,MAAM,cAAc;AAEpB,MAAM,WAAW,GAAG,WAAW,GAAG,MAAM;AAMjC,MAAM,aAAa,eAAe,UAAU,CAAC;AAM7C,MAAM,kBAAkB,eAAe,UAAU,CAAC;AAMlD,MAAM,oBAAoB,eAAe,QAAQ,CAAC;AAMlD,MAAM,yBAAyB,eAAe,QAAQ,CAAC;AAqBvD,MAAM,iCAAiC,CAAC,OAAe,MAAM;AAClE,MAAI,YAAY;AAChB,SAAO,MAAM;AACX,YAAQ,aAAa,SAAA,EAAW,SAAS,MAAM,GAAG;AAAA,EACpD;AACF;AAiBO,MAAM,0BAA0B,+BAAA;AAOhC,MAAM,uBAAuB,MAClC,IAAI,MAAA,EAAQ,MAAO,MAAM,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE;"}
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
- const async = require("yummies/async");
4
- const fetchLazyModule = async (fetchModule, attempts = 3, delay = 1e3) => {
5
- const attemptsArray = Array.from({
6
- length: attempts
7
- }).fill(fetchModule);
8
- let lastError = null;
9
- for await (const attempt of attemptsArray) {
10
- try {
11
- if (lastError !== null) {
12
- await async.sleep(delay);
13
- }
14
- return await attempt();
15
- } catch (error) {
16
- lastError = error;
17
- }
18
- }
19
- throw lastError;
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
- const unpackAsyncModule = async (maybeModule) => {
22
- if (maybeModule instanceof Promise) {
23
- const data = await maybeModule;
24
- if (data.default) {
25
- return data.default;
26
- } else {
27
- return data;
28
- }
29
- }
30
- return maybeModule;
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
- //# sourceMappingURL=imports.cjs.map
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 * Функция ленивой загрузки модуля, с возможностью вызова доп. попыток\n * @example\n * ```ts\n * fetchLazyModule(() => import(\"./test.ts\"), 3) // начнет загрузку test.ts\n * // Произошла ошибка загрузки test.ts, тогда fetchLazyModule повторно вызовет fn()\n * // Вызывать будет столько раз сколько указано attempts (по умолчанию 3)\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\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"],"names":["sleep"],"mappings":";;;AAWO,MAAM,kBAAkB,OAC7B,aACA,WAAW,GACX,QAAQ,QACO;AACf,QAAM,gBAAgB,MAAM,KAAyB;AAAA,IACnD,QAAQ;AAAA,EAAA,CACT,EAAE,KAAK,WAAW;AAEnB,MAAI,YAA0B;AAE9B,mBAAiB,WAAW,eAAe;AACzC,QAAI;AACF,UAAI,cAAc,MAAM;AACtB,cAAMA,MAAAA,MAAM,KAAK;AAAA,MACnB;AACA,aAAO,MAAM,QAAA;AAAA,IACf,SAAS,OAAO;AACd,kBAAY;AAAA,IACd;AAAA,EACF;AACA,QAAM;AACR;AAIO,MAAM,oBAAoB,OAC/B,gBACe;AACf,MAAI,uBAAuB,SAAS;AAClC,UAAM,OAAQ,MAAM;AAEpB,QAAK,KAAa,SAAS;AACzB,aAAQ,KAAa;AAAA,IACvB,OAAO;AACL,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;;;"}
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("./test.ts"), 3) // начнет загрузку test.ts
6
- * // Произошла ошибка загрузки test.ts, тогда fetchLazyModule повторно вызовет fn()
7
- * // Вызывать будет столько раз сколько указано attempts (по умолчанию 3)
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
- const fetchLazyModule = async (fetchModule, attempts = 3, delay = 1e3) => {
3
- const attemptsArray = Array.from({
4
- length: attempts
5
- }).fill(fetchModule);
6
- let lastError = null;
7
- for await (const attempt of attemptsArray) {
8
- try {
9
- if (lastError !== null) {
10
- await sleep(delay);
11
- }
12
- return await attempt();
13
- } catch (error) {
14
- lastError = error;
15
- }
16
- }
17
- throw lastError;
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
- const unpackAsyncModule = async (maybeModule) => {
20
- if (maybeModule instanceof Promise) {
21
- const data = await maybeModule;
22
- if (data.default) {
23
- return data.default;
24
- } else {
25
- return data;
26
- }
27
- }
28
- return maybeModule;
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
- export {
31
- fetchLazyModule,
32
- unpackAsyncModule
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 * Функция ленивой загрузки модуля, с возможностью вызова доп. попыток\n * @example\n * ```ts\n * fetchLazyModule(() => import(\"./test.ts\"), 3) // начнет загрузку test.ts\n * // Произошла ошибка загрузки test.ts, тогда fetchLazyModule повторно вызовет fn()\n * // Вызывать будет столько раз сколько указано attempts (по умолчанию 3)\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\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"],"names":[],"mappings":";AAWO,MAAM,kBAAkB,OAC7B,aACA,WAAW,GACX,QAAQ,QACO;AACf,QAAM,gBAAgB,MAAM,KAAyB;AAAA,IACnD,QAAQ;AAAA,EAAA,CACT,EAAE,KAAK,WAAW;AAEnB,MAAI,YAA0B;AAE9B,mBAAiB,WAAW,eAAe;AACzC,QAAI;AACF,UAAI,cAAc,MAAM;AACtB,cAAM,MAAM,KAAK;AAAA,MACnB;AACA,aAAO,MAAM,QAAA;AAAA,IACf,SAAS,OAAO;AACd,kBAAY;AAAA,IACd;AAAA,EACF;AACA,QAAM;AACR;AAIO,MAAM,oBAAoB,OAC/B,gBACe;AACf,MAAI,uBAAuB,SAAS;AAClC,UAAM,OAAQ,MAAM;AAEpB,QAAK,KAAa,SAAS;AACzB,aAAQ,KAAa;AAAA,IACvB,OAAO;AACL,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;"}
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
- return deg * (Math.PI / 180);
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
- return rad * (180 / Math.PI);
23
+ return rad * (180 / Math.PI);
8
24
  }
9
- const percentFrom = (value, from) => {
10
- return (value ?? 0) / (from ?? 0) * 100 || 0;
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
- //# sourceMappingURL=math.cjs.map
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 * Получить процент от числа\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"],"names":[],"mappings":";;AAEO,SAAS,SAAS,KAAa;AACpC,SAAO,OAAO,KAAK,KAAK;AAC1B;AACO,SAAS,SAAS,KAAa;AACpC,SAAO,OAAO,MAAM,KAAK;AAC3B;AAUO,MAAM,cAAc,CAAC,OAAsB,SAAwB;AACxE,UAAS,SAAS,MAAM,QAAQ,KAAM,OAAO;AAC/C;;;;"}
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
- return deg * (Math.PI / 180);
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
- return rad * (180 / Math.PI);
22
+ return rad * (180 / Math.PI);
6
23
  }
7
- const percentFrom = (value, from) => {
8
- return (value ?? 0) / (from ?? 0) * 100 || 0;
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
- export {
11
- degToRad,
12
- percentFrom,
13
- radToDeg
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 * Получить процент от числа\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"],"names":[],"mappings":"AAEO,SAAS,SAAS,KAAa;AACpC,SAAO,OAAO,KAAK,KAAK;AAC1B;AACO,SAAS,SAAS,KAAa;AACpC,SAAO,OAAO,MAAM,KAAK;AAC3B;AAUO,MAAM,cAAc,CAAC,OAAsB,SAAwB;AACxE,UAAS,SAAS,MAAM,QAAQ,KAAM,OAAO;AAC/C;"}
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"}