yummies 7.11.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 (146) hide show
  1. package/async.cjs +162 -48
  2. package/async.cjs.map +1 -1
  3. package/async.d.ts +108 -7
  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 -128
  14. package/complex.cjs.map +1 -1
  15. package/complex.js +275 -133
  16. package/complex.js.map +1 -1
  17. package/cookie.cjs +17 -7
  18. package/cookie.cjs.map +1 -1
  19. package/cookie.d.ts +8 -0
  20. package/cookie.js +18 -9
  21. package/cookie.js.map +1 -1
  22. package/css.cjs +147 -39
  23. package/css.cjs.map +1 -1
  24. package/css.d.ts +98 -6
  25. package/css.js +143 -41
  26. package/css.js.map +1 -1
  27. package/data.cjs +90 -55
  28. package/data.cjs.map +1 -1
  29. package/data.d.ts +32 -0
  30. package/data.js +91 -61
  31. package/data.js.map +1 -1
  32. package/date-time.cjs +578 -412
  33. package/date-time.cjs.map +1 -1
  34. package/date-time.d.ts +88 -0
  35. package/date-time.js +575 -421
  36. package/date-time.js.map +1 -1
  37. package/device.cjs +48 -23
  38. package/device.cjs.map +1 -1
  39. package/device.d.ts +32 -0
  40. package/device.js +49 -31
  41. package/device.js.map +1 -1
  42. package/encodings.cjs +275 -266
  43. package/encodings.cjs.map +1 -1
  44. package/encodings.d.ts +8 -0
  45. package/encodings.js +276 -268
  46. package/encodings.js.map +1 -1
  47. package/errors.cjs +20 -18
  48. package/errors.cjs.map +1 -1
  49. package/errors.js +19 -19
  50. package/errors.js.map +1 -1
  51. package/file.cjs +42 -24
  52. package/file.cjs.map +1 -1
  53. package/file.d.ts +16 -0
  54. package/file.js +43 -27
  55. package/file.js.map +1 -1
  56. package/format.cjs +125 -83
  57. package/format.cjs.map +1 -1
  58. package/format.js +118 -82
  59. package/format.js.map +1 -1
  60. package/html.cjs +226 -137
  61. package/html.cjs.map +1 -1
  62. package/html.d.ts +64 -0
  63. package/html.js +223 -150
  64. package/html.js.map +1 -1
  65. package/id.cjs +74 -17
  66. package/id.cjs.map +1 -1
  67. package/id.js +73 -24
  68. package/id.js.map +1 -1
  69. package/imports.cjs +41 -29
  70. package/imports.cjs.map +1 -1
  71. package/imports.d.ts +8 -0
  72. package/imports.js +40 -31
  73. package/imports.js.map +1 -1
  74. package/math.cjs +32 -6
  75. package/math.cjs.map +1 -1
  76. package/math.d.ts +16 -0
  77. package/math.js +33 -10
  78. package/math.js.map +1 -1
  79. package/media.cjs +275 -84
  80. package/media.cjs.map +1 -1
  81. package/media.d.ts +188 -2
  82. package/media.js +274 -93
  83. package/media.js.map +1 -1
  84. package/mobx.cjs +353 -193
  85. package/mobx.cjs.map +1 -1
  86. package/mobx.d.ts +7 -0
  87. package/mobx.js +351 -200
  88. package/mobx.js.map +1 -1
  89. package/ms.cjs +21 -10
  90. package/ms.cjs.map +1 -1
  91. package/ms.js +22 -13
  92. package/ms.js.map +1 -1
  93. package/number.cjs +13 -7
  94. package/number.cjs.map +1 -1
  95. package/number.js +14 -9
  96. package/number.js.map +1 -1
  97. package/package.json +10 -2
  98. package/parser.cjs +117 -64
  99. package/parser.cjs.map +1 -1
  100. package/parser.js +111 -64
  101. package/parser.js.map +1 -1
  102. package/price.cjs +24 -18
  103. package/price.cjs.map +1 -1
  104. package/price.d.ts +8 -0
  105. package/price.js +25 -20
  106. package/price.js.map +1 -1
  107. package/random.cjs +79 -13
  108. package/random.cjs.map +1 -1
  109. package/random.d.ts +64 -0
  110. package/random.js +80 -22
  111. package/random.js.map +1 -1
  112. package/react.cjs +673 -214
  113. package/react.cjs.map +1 -1
  114. package/react.d.ts +21 -0
  115. package/react.js +674 -239
  116. package/react.js.map +1 -1
  117. package/sound.cjs +14 -9
  118. package/sound.cjs.map +1 -1
  119. package/sound.js +15 -11
  120. package/sound.js.map +1 -1
  121. package/storage.cjs +49 -50
  122. package/storage.cjs.map +1 -1
  123. package/storage.d.ts +8 -0
  124. package/storage.js +50 -53
  125. package/storage.js.map +1 -1
  126. package/text.cjs +51 -34
  127. package/text.cjs.map +1 -1
  128. package/text.js +52 -37
  129. package/text.js.map +1 -1
  130. package/type-guard.cjs +292 -72
  131. package/type-guard.cjs.map +1 -1
  132. package/type-guard.js +288 -73
  133. package/type-guard.js.map +1 -1
  134. package/types.cjs +0 -2
  135. package/types.global.cjs +0 -2
  136. package/types.global.js +0 -2
  137. package/types.js +0 -2
  138. package/vibrate.cjs +31 -6
  139. package/vibrate.cjs.map +1 -1
  140. package/vibrate.d.ts +23 -1
  141. package/vibrate.js +32 -8
  142. package/vibrate.js.map +1 -1
  143. package/types.cjs.map +0 -1
  144. package/types.global.cjs.map +0 -1
  145. package/types.global.js.map +0 -1
  146. 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 * 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"],"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.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 * 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"],"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 * 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\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":";;;AAYO,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
@@ -12,6 +12,14 @@ declare const fetchLazyModule: <T>(fetchModule: () => Promise<T>, attempts?: num
12
12
  type PackedAsyncModule<T> = Promise<T | {
13
13
  default: T;
14
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
+ */
15
23
  declare const unpackAsyncModule: <T>(maybeModule: T | PackedAsyncModule<T>) => Promise<T>;
16
24
 
17
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 * 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\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":";AAYO,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 * 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"],"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,6 +1,22 @@
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`.
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 * 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"],"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"}