es-toolkit 0.0.1

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 (303) hide show
  1. package/.vscode/extensions.json +7 -0
  2. package/.vscode/settings.json +10 -0
  3. package/.yarn/sdks/eslint/bin/eslint.js +20 -0
  4. package/.yarn/sdks/eslint/lib/api.js +20 -0
  5. package/.yarn/sdks/eslint/lib/unsupported-api.js +20 -0
  6. package/.yarn/sdks/eslint/package.json +14 -0
  7. package/.yarn/sdks/integrations.yml +5 -0
  8. package/.yarn/sdks/prettier/bin/prettier.cjs +20 -0
  9. package/.yarn/sdks/prettier/index.cjs +20 -0
  10. package/.yarn/sdks/prettier/package.json +7 -0
  11. package/.yarn/sdks/typescript/bin/tsc +20 -0
  12. package/.yarn/sdks/typescript/bin/tsserver +20 -0
  13. package/.yarn/sdks/typescript/lib/tsc.js +20 -0
  14. package/.yarn/sdks/typescript/lib/tsserver.js +225 -0
  15. package/.yarn/sdks/typescript/lib/tsserverlibrary.js +225 -0
  16. package/.yarn/sdks/typescript/lib/typescript.js +20 -0
  17. package/.yarn/sdks/typescript/package.json +10 -0
  18. package/babel.config.js +6 -0
  19. package/coverage/.tmp/coverage-0.json +1 -0
  20. package/coverage/.tmp/coverage-1.json +1 -0
  21. package/coverage/.tmp/coverage-10.json +1 -0
  22. package/coverage/.tmp/coverage-11.json +1 -0
  23. package/coverage/.tmp/coverage-12.json +1 -0
  24. package/coverage/.tmp/coverage-13.json +1 -0
  25. package/coverage/.tmp/coverage-14.json +1 -0
  26. package/coverage/.tmp/coverage-15.json +1 -0
  27. package/coverage/.tmp/coverage-16.json +1 -0
  28. package/coverage/.tmp/coverage-17.json +1 -0
  29. package/coverage/.tmp/coverage-18.json +1 -0
  30. package/coverage/.tmp/coverage-19.json +1 -0
  31. package/coverage/.tmp/coverage-2.json +1 -0
  32. package/coverage/.tmp/coverage-20.json +1 -0
  33. package/coverage/.tmp/coverage-21.json +1 -0
  34. package/coverage/.tmp/coverage-22.json +1 -0
  35. package/coverage/.tmp/coverage-23.json +1 -0
  36. package/coverage/.tmp/coverage-24.json +1 -0
  37. package/coverage/.tmp/coverage-25.json +1 -0
  38. package/coverage/.tmp/coverage-26.json +1 -0
  39. package/coverage/.tmp/coverage-27.json +1 -0
  40. package/coverage/.tmp/coverage-28.json +1 -0
  41. package/coverage/.tmp/coverage-29.json +1 -0
  42. package/coverage/.tmp/coverage-3.json +1 -0
  43. package/coverage/.tmp/coverage-30.json +1 -0
  44. package/coverage/.tmp/coverage-4.json +1 -0
  45. package/coverage/.tmp/coverage-5.json +1 -0
  46. package/coverage/.tmp/coverage-6.json +1 -0
  47. package/coverage/.tmp/coverage-7.json +1 -0
  48. package/coverage/.tmp/coverage-8.json +1 -0
  49. package/coverage/.tmp/coverage-9.json +1 -0
  50. package/dist/array/chunk.d.ts +8 -0
  51. package/dist/array/chunk.spec.d.ts +1 -0
  52. package/dist/array/difference.d.ts +7 -0
  53. package/dist/array/difference.spec.d.ts +1 -0
  54. package/dist/array/differenceBy.d.ts +8 -0
  55. package/dist/array/differenceBy.spec.d.ts +1 -0
  56. package/dist/array/differenceWith.d.ts +8 -0
  57. package/dist/array/differenceWith.spec.d.ts +1 -0
  58. package/dist/array/drop.d.ts +7 -0
  59. package/dist/array/drop.spec.d.ts +1 -0
  60. package/dist/array/dropRight.d.ts +7 -0
  61. package/dist/array/dropRight.spec.d.ts +1 -0
  62. package/dist/array/dropRightWhile.d.ts +7 -0
  63. package/dist/array/dropRightWhile.spec.d.ts +1 -0
  64. package/dist/array/dropWhile.d.ts +7 -0
  65. package/dist/array/dropWhile.spec.d.ts +1 -0
  66. package/dist/array/groupBy.d.ts +1 -0
  67. package/dist/array/index.d.ts +30 -0
  68. package/dist/array/index.js +778 -0
  69. package/dist/array/intersection.d.ts +11 -0
  70. package/dist/array/intersection.spec.d.ts +1 -0
  71. package/dist/array/intersectionBy.d.ts +12 -0
  72. package/dist/array/intersectionBy.spec.d.ts +1 -0
  73. package/dist/array/intersectionWith.d.ts +12 -0
  74. package/dist/array/intersectionWith.spec.d.ts +1 -0
  75. package/dist/array/partition.d.ts +8 -0
  76. package/dist/array/partition.spec.d.ts +1 -0
  77. package/dist/array/sample.d.ts +7 -0
  78. package/dist/array/sample.spec.d.ts +1 -0
  79. package/dist/array/shuffle.d.ts +7 -0
  80. package/dist/array/shuffle.spec.d.ts +1 -0
  81. package/dist/array/take.d.ts +23 -0
  82. package/dist/array/take.spec.d.ts +1 -0
  83. package/dist/array/takeRight.d.ts +23 -0
  84. package/dist/array/takeRight.spec.d.ts +1 -0
  85. package/dist/array/takeRightWhile.d.ts +18 -0
  86. package/dist/array/takeRightWhile.spec.d.ts +1 -0
  87. package/dist/array/takeWhile.d.ts +19 -0
  88. package/dist/array/takeWhile.spec.d.ts +1 -0
  89. package/dist/array/union.d.ts +10 -0
  90. package/dist/array/union.spec.d.ts +1 -0
  91. package/dist/array/unionBy.d.ts +24 -0
  92. package/dist/array/unionBy.spec.d.ts +1 -0
  93. package/dist/array/unionWith.d.ts +14 -0
  94. package/dist/array/unionWith.spec.d.ts +1 -0
  95. package/dist/array/uniq.d.ts +14 -0
  96. package/dist/array/uniq.spec.d.ts +1 -0
  97. package/dist/array/uniqBy.d.ts +12 -0
  98. package/dist/array/uniqBy.spec.d.ts +1 -0
  99. package/dist/array/uniqWith.d.ts +12 -0
  100. package/dist/array/uniqWith.spec.d.ts +1 -0
  101. package/dist/array/xor.d.ts +19 -0
  102. package/dist/array/xor.spec.d.ts +1 -0
  103. package/dist/array/xorBy.d.ts +20 -0
  104. package/dist/array/xorBy.spec.d.ts +1 -0
  105. package/dist/array/xorWith.d.ts +19 -0
  106. package/dist/array/xorWith.spec.d.ts +1 -0
  107. package/dist/array/zip.d.ts +13 -0
  108. package/dist/array/zip.spec.d.ts +1 -0
  109. package/dist/array/zipWith.d.ts +9 -0
  110. package/dist/array/zipWith.spec.d.ts +1 -0
  111. package/dist/function/debounce.d.ts +24 -0
  112. package/dist/function/debounce.spec.d.ts +1 -0
  113. package/dist/function/index.d.ts +3 -0
  114. package/dist/function/index.js +113 -0
  115. package/dist/function/once.d.ts +18 -0
  116. package/dist/function/once.spec.d.ts +1 -0
  117. package/dist/function/throttle.d.ts +26 -0
  118. package/dist/function/throttle.spec.d.ts +1 -0
  119. package/dist/index.d.ts +6 -0
  120. package/dist/index.js +1111 -0
  121. package/dist/math/clamp.d.ts +11 -0
  122. package/dist/math/clamp.spec.d.ts +1 -0
  123. package/dist/math/index.d.ts +3 -0
  124. package/dist/math/index.js +63 -0
  125. package/dist/math/round.d.ts +13 -0
  126. package/dist/math/round.spec.d.ts +1 -0
  127. package/dist/math/sum.d.ts +13 -0
  128. package/dist/math/sum.spec.d.ts +1 -0
  129. package/dist/object/index.d.ts +4 -0
  130. package/dist/object/index.js +176 -0
  131. package/dist/object/omit.d.ts +7 -0
  132. package/dist/object/omit.spec.d.ts +1 -0
  133. package/dist/object/omitBy.d.ts +1 -0
  134. package/dist/object/pick.d.ts +7 -0
  135. package/dist/object/pick.spec.d.ts +1 -0
  136. package/dist/object/pickBy.d.ts +1 -0
  137. package/dist/predicate/index.d.ts +4 -0
  138. package/dist/predicate/index.js +50 -0
  139. package/dist/predicate/isNil.d.ts +6 -0
  140. package/dist/predicate/isNil.spec.d.ts +1 -0
  141. package/dist/predicate/isNotNil.d.ts +12 -0
  142. package/dist/predicate/isNotNil.spec.d.ts +1 -0
  143. package/dist/predicate/isNull.d.ts +6 -0
  144. package/dist/predicate/isNull.spec.d.ts +1 -0
  145. package/dist/predicate/isUndefined.d.ts +6 -0
  146. package/dist/predicate/isUndefined.spec.d.ts +1 -0
  147. package/dist/promise/delay.d.ts +6 -0
  148. package/dist/promise/delay.spec.d.ts +1 -0
  149. package/dist/promise/index.d.ts +1 -0
  150. package/dist/promise/index.js +16 -0
  151. package/esm/_virtual/_rollupPluginBabelHelpers.mjs +163 -0
  152. package/esm/array/_virtual/_rollupPluginBabelHelpers.mjs +114 -0
  153. package/esm/array/chunk.mjs +35 -0
  154. package/esm/array/difference.mjs +13 -0
  155. package/esm/array/differenceBy.mjs +17 -0
  156. package/esm/array/differenceWith.mjs +16 -0
  157. package/esm/array/drop.mjs +11 -0
  158. package/esm/array/dropRight.mjs +11 -0
  159. package/esm/array/dropRightWhile.mjs +15 -0
  160. package/esm/array/dropWhile.mjs +14 -0
  161. package/esm/array/groupBy.mjs +5 -0
  162. package/esm/array/index.mjs +30 -0
  163. package/esm/array/intersection.mjs +17 -0
  164. package/esm/array/intersectionBy.mjs +21 -0
  165. package/esm/array/intersectionWith.mjs +20 -0
  166. package/esm/array/partition.mjs +32 -0
  167. package/esm/array/sample.mjs +12 -0
  168. package/esm/array/shuffle.mjs +20 -0
  169. package/esm/array/take.mjs +27 -0
  170. package/esm/array/takeRight.mjs +30 -0
  171. package/esm/array/takeRightWhile.mjs +27 -0
  172. package/esm/array/takeWhile.mjs +41 -0
  173. package/esm/array/union.mjs +19 -0
  174. package/esm/array/unionBy.mjs +38 -0
  175. package/esm/array/unionWith.mjs +21 -0
  176. package/esm/array/uniq.mjs +18 -0
  177. package/esm/array/uniqBy.mjs +20 -0
  178. package/esm/array/uniqWith.mjs +39 -0
  179. package/esm/array/xor.mjs +27 -0
  180. package/esm/array/xorBy.mjs +30 -0
  181. package/esm/array/xorWith.mjs +29 -0
  182. package/esm/array/zip.mjs +40 -0
  183. package/esm/array/zipWith.mjs +31 -0
  184. package/esm/function/debounce.mjs +39 -0
  185. package/esm/function/index.mjs +3 -0
  186. package/esm/function/once.mjs +32 -0
  187. package/esm/function/throttle.mjs +38 -0
  188. package/esm/index.mjs +45 -0
  189. package/esm/math/clamp.mjs +18 -0
  190. package/esm/math/index.mjs +3 -0
  191. package/esm/math/round.mjs +19 -0
  192. package/esm/math/sum.mjs +22 -0
  193. package/esm/object/_virtual/_rollupPluginBabelHelpers.mjs +115 -0
  194. package/esm/object/index.mjs +4 -0
  195. package/esm/object/omit.mjs +26 -0
  196. package/esm/object/omitBy.mjs +5 -0
  197. package/esm/object/pick.mjs +26 -0
  198. package/esm/object/pickBy.mjs +5 -0
  199. package/esm/predicate/index.mjs +4 -0
  200. package/esm/predicate/isNil.mjs +10 -0
  201. package/esm/predicate/isNotNil.mjs +16 -0
  202. package/esm/predicate/isNull.mjs +10 -0
  203. package/esm/predicate/isUndefined.mjs +10 -0
  204. package/esm/promise/delay.mjs +12 -0
  205. package/esm/promise/index.mjs +1 -0
  206. package/package.json +94 -0
  207. package/rollup.config.js +5 -0
  208. package/src/array/chunk.spec.ts +27 -0
  209. package/src/array/chunk.ts +24 -0
  210. package/src/array/difference.spec.ts +10 -0
  211. package/src/array/difference.ts +11 -0
  212. package/src/array/differenceBy.spec.ts +9 -0
  213. package/src/array/differenceBy.ts +14 -0
  214. package/src/array/differenceWith.spec.ts +8 -0
  215. package/src/array/differenceWith.ts +14 -0
  216. package/src/array/drop.spec.ts +9 -0
  217. package/src/array/drop.ts +9 -0
  218. package/src/array/dropRight.spec.ts +9 -0
  219. package/src/array/dropRight.ts +9 -0
  220. package/src/array/dropRightWhile.spec.ts +16 -0
  221. package/src/array/dropRightWhile.ts +13 -0
  222. package/src/array/dropWhile.spec.ts +14 -0
  223. package/src/array/dropWhile.ts +10 -0
  224. package/src/array/groupBy.ts +3 -0
  225. package/src/array/index.ts +30 -0
  226. package/src/array/intersection.spec.ts +11 -0
  227. package/src/array/intersection.ts +15 -0
  228. package/src/array/intersectionBy.spec.ts +9 -0
  229. package/src/array/intersectionBy.ts +18 -0
  230. package/src/array/intersectionWith.spec.ts +9 -0
  231. package/src/array/intersectionWith.ts +18 -0
  232. package/src/array/partition.spec.ts +23 -0
  233. package/src/array/partition.ts +21 -0
  234. package/src/array/sample.spec.ts +11 -0
  235. package/src/array/sample.ts +10 -0
  236. package/src/array/shuffle.spec.ts +11 -0
  237. package/src/array/shuffle.ts +18 -0
  238. package/src/array/take.spec.ts +25 -0
  239. package/src/array/take.ts +25 -0
  240. package/src/array/takeRight.spec.ts +25 -0
  241. package/src/array/takeRight.ts +29 -0
  242. package/src/array/takeRightWhile.spec.ts +16 -0
  243. package/src/array/takeRightWhile.ts +26 -0
  244. package/src/array/takeWhile.spec.ts +34 -0
  245. package/src/array/takeWhile.ts +31 -0
  246. package/src/array/union.spec.ts +10 -0
  247. package/src/array/union.ts +14 -0
  248. package/src/array/unionBy.spec.ts +12 -0
  249. package/src/array/unionBy.ts +35 -0
  250. package/src/array/unionWith.spec.ts +23 -0
  251. package/src/array/unionWith.ts +18 -0
  252. package/src/array/uniq.spec.ts +8 -0
  253. package/src/array/uniq.ts +16 -0
  254. package/src/array/uniqBy.spec.ts +8 -0
  255. package/src/array/uniqBy.ts +17 -0
  256. package/src/array/uniqWith.spec.ts +16 -0
  257. package/src/array/uniqWith.ts +29 -0
  258. package/src/array/xor.spec.ts +13 -0
  259. package/src/array/xor.ts +25 -0
  260. package/src/array/xorBy.spec.ts +16 -0
  261. package/src/array/xorBy.ts +29 -0
  262. package/src/array/xorWith.spec.ts +16 -0
  263. package/src/array/xorWith.ts +28 -0
  264. package/src/array/zip.spec.ts +14 -0
  265. package/src/array/zip.ts +34 -0
  266. package/src/array/zipWith.spec.ts +13 -0
  267. package/src/array/zipWith.ts +23 -0
  268. package/src/function/debounce.spec.ts +76 -0
  269. package/src/function/debounce.ts +42 -0
  270. package/src/function/index.ts +3 -0
  271. package/src/function/once.spec.ts +31 -0
  272. package/src/function/once.ts +34 -0
  273. package/src/function/throttle.spec.ts +32 -0
  274. package/src/function/throttle.ts +39 -0
  275. package/src/index.ts +6 -0
  276. package/src/math/clamp.spec.ts +18 -0
  277. package/src/math/clamp.ts +17 -0
  278. package/src/math/index.ts +3 -0
  279. package/src/math/round.spec.ts +53 -0
  280. package/src/math/round.ts +16 -0
  281. package/src/math/sum.spec.ts +29 -0
  282. package/src/math/sum.ts +17 -0
  283. package/src/object/index.ts +4 -0
  284. package/src/object/omit.spec.ts +10 -0
  285. package/src/object/omit.ts +15 -0
  286. package/src/object/omitBy.ts +3 -0
  287. package/src/object/pick.spec.ts +10 -0
  288. package/src/object/pick.ts +15 -0
  289. package/src/object/pickBy.ts +3 -0
  290. package/src/predicate/index.ts +4 -0
  291. package/src/predicate/isNil.spec.ts +23 -0
  292. package/src/predicate/isNil.ts +8 -0
  293. package/src/predicate/isNotNil.spec.ts +29 -0
  294. package/src/predicate/isNotNil.ts +14 -0
  295. package/src/predicate/isNull.spec.ts +23 -0
  296. package/src/predicate/isNull.ts +8 -0
  297. package/src/predicate/isUndefined.spec.ts +23 -0
  298. package/src/predicate/isUndefined.ts +8 -0
  299. package/src/promise/delay.spec.ts +13 -0
  300. package/src/promise/delay.ts +10 -0
  301. package/src/promise/index.ts +1 -0
  302. package/tsconfig.json +12 -0
  303. package/vitest.config.mts +13 -0
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @name clamp
3
+ * @description Checks if `value` is within the bounds, if not return the closest bound (bound1: min, bound2: max)
4
+ * function clamp(value: number, bound1: number, bound2?: number): number
5
+ * @example
6
+ * clamp(3, 1) // 3
7
+ * clamp(3, 1, 5) // 3
8
+ * clamp(3, 5) // 5
9
+ * clamp(7, 3, 5) // 5
10
+ */
11
+ export declare function clamp(value: number, bound1: number, bound2?: number): number;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export { clamp } from './clamp';
2
+ export { round } from './round';
3
+ export { sum } from './sum';
@@ -0,0 +1,63 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /**
6
+ * @name clamp
7
+ * @description Checks if `value` is within the bounds, if not return the closest bound (bound1: min, bound2: max)
8
+ * function clamp(value: number, bound1: number, bound2?: number): number
9
+ * @example
10
+ * clamp(3, 1) // 3
11
+ * clamp(3, 1, 5) // 3
12
+ * clamp(3, 5) // 5
13
+ * clamp(7, 3, 5) // 5
14
+ */
15
+ function clamp(value, bound1, bound2) {
16
+ if (bound2 == null) {
17
+ return Math.min(value, bound1);
18
+ }
19
+ return Math.min(Math.max(value, bound1), bound2);
20
+ }
21
+
22
+ /**
23
+ * @name round
24
+ * @description Rounds given number to given precision
25
+ * ```typescript
26
+ * function round(value: number, precision: number = 0): number
27
+ * ```
28
+ *
29
+ * @example
30
+ * round(1.2) === 1
31
+ * round(3.9) === 4
32
+ * round(8.5) === 9
33
+ */
34
+ function round(value) {
35
+ var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
36
+ var multiplier = Math.pow(10, precision);
37
+ return Math.round(value * multiplier) / multiplier;
38
+ }
39
+
40
+ /**
41
+ * @name sum
42
+ * @description Return the sum of given values.
43
+ * ```typescript
44
+ * function sum(...nums: number[] | number[][]): number;
45
+ * ```
46
+ *
47
+ * @example
48
+ * sum(1, 2, 3) === 6
49
+ * sum(...[1, 2, 3]) === 6
50
+ * sum([1, 2, 3]) === 6
51
+ */
52
+ function sum() {
53
+ for (var _len = arguments.length, nums = new Array(_len), _key = 0; _key < _len; _key++) {
54
+ nums[_key] = arguments[_key];
55
+ }
56
+ return nums.flat().reduce(function (acc, curr) {
57
+ return acc + curr;
58
+ }, 0);
59
+ }
60
+
61
+ exports.clamp = clamp;
62
+ exports.round = round;
63
+ exports.sum = sum;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @name round
3
+ * @description Rounds given number to given precision
4
+ * ```typescript
5
+ * function round(value: number, precision: number = 0): number
6
+ * ```
7
+ *
8
+ * @example
9
+ * round(1.2) === 1
10
+ * round(3.9) === 4
11
+ * round(8.5) === 9
12
+ */
13
+ export declare function round(value: number, precision?: number): number;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @name sum
3
+ * @description Return the sum of given values.
4
+ * ```typescript
5
+ * function sum(...nums: number[] | number[][]): number;
6
+ * ```
7
+ *
8
+ * @example
9
+ * sum(1, 2, 3) === 6
10
+ * sum(...[1, 2, 3]) === 6
11
+ * sum([1, 2, 3]) === 6
12
+ */
13
+ export declare function sum(...nums: number[] | number[][]): number;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export { omit } from './omit';
2
+ export { omitBy } from './omitBy';
3
+ export { pick } from './pick';
4
+ export { pickBy } from './pickBy';
@@ -0,0 +1,176 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function ownKeys(e, r) {
6
+ var t = Object.keys(e);
7
+ if (Object.getOwnPropertySymbols) {
8
+ var o = Object.getOwnPropertySymbols(e);
9
+ r && (o = o.filter(function (r) {
10
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
11
+ })), t.push.apply(t, o);
12
+ }
13
+ return t;
14
+ }
15
+ function _objectSpread2(e) {
16
+ for (var r = 1; r < arguments.length; r++) {
17
+ var t = null != arguments[r] ? arguments[r] : {};
18
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
19
+ _defineProperty(e, r, t[r]);
20
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
21
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
22
+ });
23
+ }
24
+ return e;
25
+ }
26
+ function _toPrimitive(t, r) {
27
+ if ("object" != typeof t || !t) return t;
28
+ var e = t[Symbol.toPrimitive];
29
+ if (void 0 !== e) {
30
+ var i = e.call(t, r || "default");
31
+ if ("object" != typeof i) return i;
32
+ throw new TypeError("@@toPrimitive must return a primitive value.");
33
+ }
34
+ return ("string" === r ? String : Number)(t);
35
+ }
36
+ function _toPropertyKey(t) {
37
+ var i = _toPrimitive(t, "string");
38
+ return "symbol" == typeof i ? i : i + "";
39
+ }
40
+ function _defineProperty(obj, key, value) {
41
+ key = _toPropertyKey(key);
42
+ if (key in obj) {
43
+ Object.defineProperty(obj, key, {
44
+ value: value,
45
+ enumerable: true,
46
+ configurable: true,
47
+ writable: true
48
+ });
49
+ } else {
50
+ obj[key] = value;
51
+ }
52
+ return obj;
53
+ }
54
+ function _unsupportedIterableToArray(o, minLen) {
55
+ if (!o) return;
56
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
57
+ var n = Object.prototype.toString.call(o).slice(8, -1);
58
+ if (n === "Object" && o.constructor) n = o.constructor.name;
59
+ if (n === "Map" || n === "Set") return Array.from(o);
60
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
61
+ }
62
+ function _arrayLikeToArray(arr, len) {
63
+ if (len == null || len > arr.length) len = arr.length;
64
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
65
+ return arr2;
66
+ }
67
+ function _createForOfIteratorHelper(o, allowArrayLike) {
68
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
69
+ if (!it) {
70
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
71
+ if (it) o = it;
72
+ var i = 0;
73
+ var F = function () {};
74
+ return {
75
+ s: F,
76
+ n: function () {
77
+ if (i >= o.length) return {
78
+ done: true
79
+ };
80
+ return {
81
+ done: false,
82
+ value: o[i++]
83
+ };
84
+ },
85
+ e: function (e) {
86
+ throw e;
87
+ },
88
+ f: F
89
+ };
90
+ }
91
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
92
+ }
93
+ var normalCompletion = true,
94
+ didErr = false,
95
+ err;
96
+ return {
97
+ s: function () {
98
+ it = it.call(o);
99
+ },
100
+ n: function () {
101
+ var step = it.next();
102
+ normalCompletion = step.done;
103
+ return step;
104
+ },
105
+ e: function (e) {
106
+ didErr = true;
107
+ err = e;
108
+ },
109
+ f: function () {
110
+ try {
111
+ if (!normalCompletion && it.return != null) it.return();
112
+ } finally {
113
+ if (didErr) throw err;
114
+ }
115
+ }
116
+ };
117
+ }
118
+
119
+ /**
120
+ * @name omit
121
+ * Omit properties from an object.
122
+ * @param obj The object to omit properties from
123
+ * @param keys The keys to omit from an object
124
+ */
125
+ function omit(obj, keys) {
126
+ var result = _objectSpread2({}, obj);
127
+ var _iterator = _createForOfIteratorHelper(keys),
128
+ _step;
129
+ try {
130
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
131
+ var key = _step.value;
132
+ delete result[key];
133
+ }
134
+ } catch (err) {
135
+ _iterator.e(err);
136
+ } finally {
137
+ _iterator.f();
138
+ }
139
+ return result;
140
+ }
141
+
142
+ function omitBy() {
143
+ throw new Error('Not implemented');
144
+ }
145
+
146
+ /**
147
+ * @name pick
148
+ * Pick properties from an given object.
149
+ * @param obj The object to pick properties from
150
+ * @param keys The keys to pick from an object
151
+ */
152
+ function pick(obj, keys) {
153
+ var result = {};
154
+ var _iterator = _createForOfIteratorHelper(keys),
155
+ _step;
156
+ try {
157
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
158
+ var key = _step.value;
159
+ result[key] = obj[key];
160
+ }
161
+ } catch (err) {
162
+ _iterator.e(err);
163
+ } finally {
164
+ _iterator.f();
165
+ }
166
+ return result;
167
+ }
168
+
169
+ function pickBy() {
170
+ throw new Error('Not implemented');
171
+ }
172
+
173
+ exports.omit = omit;
174
+ exports.omitBy = omitBy;
175
+ exports.pick = pick;
176
+ exports.pickBy = pickBy;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @name omit
3
+ * Omit properties from an object.
4
+ * @param obj The object to omit properties from
5
+ * @param keys The keys to omit from an object
6
+ */
7
+ export declare function omit<T, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function omitBy(): void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @name pick
3
+ * Pick properties from an given object.
4
+ * @param obj The object to pick properties from
5
+ * @param keys The keys to pick from an object
6
+ */
7
+ export declare function pick<T, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function pickBy(): void;
@@ -0,0 +1,4 @@
1
+ export { isNil } from './isNil';
2
+ export { isNotNil } from './isNotNil';
3
+ export { isNull } from './isNull';
4
+ export { isUndefined } from './isUndefined';
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /**
6
+ * @name isNil
7
+ * Checks if the given value is null or undefined.
8
+ * @param x The value to test if it is null or undefined
9
+ */
10
+ function isNil(x) {
11
+ return x == null || x == undefined;
12
+ }
13
+
14
+ /**
15
+ * @name isNotNil
16
+ * Checks if the given value is not null nor undefined.
17
+ * The main use of this function is to used with TypeScript as a type predicate.
18
+ * @param x The value to test if it is not null nor undefined
19
+ * @example
20
+ * // Here the type of `arr` is (number | undefined)[]
21
+ * const arr = [1, undefined, 3];
22
+ * // Here the type of `result` is number[]
23
+ * const result = arr.filter(isNotNil);
24
+ */
25
+ function isNotNil(x) {
26
+ return x != null && x != undefined;
27
+ }
28
+
29
+ /**
30
+ * @name isNull
31
+ * Checks if the given value is null.
32
+ * @param x The value to test if it is null
33
+ */
34
+ function isNull(x) {
35
+ return x === null;
36
+ }
37
+
38
+ /**
39
+ * @name isUndefined
40
+ * Checks if the given value is undefined.
41
+ * @param x The value to test if it is undefined
42
+ */
43
+ function isUndefined(x) {
44
+ return x === undefined;
45
+ }
46
+
47
+ exports.isNil = isNil;
48
+ exports.isNotNil = isNotNil;
49
+ exports.isNull = isNull;
50
+ exports.isUndefined = isUndefined;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @name isNil
3
+ * Checks if the given value is null or undefined.
4
+ * @param x The value to test if it is null or undefined
5
+ */
6
+ export declare function isNil(x: unknown): x is null | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @name isNotNil
3
+ * Checks if the given value is not null nor undefined.
4
+ * The main use of this function is to used with TypeScript as a type predicate.
5
+ * @param x The value to test if it is not null nor undefined
6
+ * @example
7
+ * // Here the type of `arr` is (number | undefined)[]
8
+ * const arr = [1, undefined, 3];
9
+ * // Here the type of `result` is number[]
10
+ * const result = arr.filter(isNotNil);
11
+ */
12
+ export declare function isNotNil<T>(x: T | null | undefined): x is T;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @name isNull
3
+ * Checks if the given value is null.
4
+ * @param x The value to test if it is null
5
+ */
6
+ export declare function isNull(x: unknown): x is null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @name isUndefined
3
+ * Checks if the given value is undefined.
4
+ * @param x The value to test if it is undefined
5
+ */
6
+ export declare function isUndefined(x: unknown): x is undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @name delay
3
+ * Pause the execution of a function for given milliseconds.
4
+ * @param ms The amount of time to delay the function.
5
+ */
6
+ export declare function delay(ms: number): Promise<unknown>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export { delay } from './delay';
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /**
6
+ * @name delay
7
+ * Pause the execution of a function for given milliseconds.
8
+ * @param ms The amount of time to delay the function.
9
+ */
10
+ function delay(ms) {
11
+ return new Promise(function (resolve) {
12
+ setTimeout(resolve, ms);
13
+ });
14
+ }
15
+
16
+ exports.delay = delay;
@@ -0,0 +1,163 @@
1
+ function _iterableToArrayLimit(r, l) {
2
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
3
+ if (null != t) {
4
+ var e,
5
+ n,
6
+ i,
7
+ u,
8
+ a = [],
9
+ f = !0,
10
+ o = !1;
11
+ try {
12
+ if (i = (t = t.call(r)).next, 0 === l) {
13
+ if (Object(t) !== t) return;
14
+ f = !1;
15
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
16
+ } catch (r) {
17
+ o = !0, n = r;
18
+ } finally {
19
+ try {
20
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
21
+ } finally {
22
+ if (o) throw n;
23
+ }
24
+ }
25
+ return a;
26
+ }
27
+ }
28
+ function ownKeys(e, r) {
29
+ var t = Object.keys(e);
30
+ if (Object.getOwnPropertySymbols) {
31
+ var o = Object.getOwnPropertySymbols(e);
32
+ r && (o = o.filter(function (r) {
33
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
34
+ })), t.push.apply(t, o);
35
+ }
36
+ return t;
37
+ }
38
+ function _objectSpread2(e) {
39
+ for (var r = 1; r < arguments.length; r++) {
40
+ var t = null != arguments[r] ? arguments[r] : {};
41
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
42
+ _defineProperty(e, r, t[r]);
43
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
44
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
45
+ });
46
+ }
47
+ return e;
48
+ }
49
+ function _toPrimitive(t, r) {
50
+ if ("object" != typeof t || !t) return t;
51
+ var e = t[Symbol.toPrimitive];
52
+ if (void 0 !== e) {
53
+ var i = e.call(t, r || "default");
54
+ if ("object" != typeof i) return i;
55
+ throw new TypeError("@@toPrimitive must return a primitive value.");
56
+ }
57
+ return ("string" === r ? String : Number)(t);
58
+ }
59
+ function _toPropertyKey(t) {
60
+ var i = _toPrimitive(t, "string");
61
+ return "symbol" == typeof i ? i : i + "";
62
+ }
63
+ function _defineProperty(obj, key, value) {
64
+ key = _toPropertyKey(key);
65
+ if (key in obj) {
66
+ Object.defineProperty(obj, key, {
67
+ value: value,
68
+ enumerable: true,
69
+ configurable: true,
70
+ writable: true
71
+ });
72
+ } else {
73
+ obj[key] = value;
74
+ }
75
+ return obj;
76
+ }
77
+ function _slicedToArray(arr, i) {
78
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
79
+ }
80
+ function _toConsumableArray(arr) {
81
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
82
+ }
83
+ function _arrayWithoutHoles(arr) {
84
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
85
+ }
86
+ function _arrayWithHoles(arr) {
87
+ if (Array.isArray(arr)) return arr;
88
+ }
89
+ function _iterableToArray(iter) {
90
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
91
+ }
92
+ function _unsupportedIterableToArray(o, minLen) {
93
+ if (!o) return;
94
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
95
+ var n = Object.prototype.toString.call(o).slice(8, -1);
96
+ if (n === "Object" && o.constructor) n = o.constructor.name;
97
+ if (n === "Map" || n === "Set") return Array.from(o);
98
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
99
+ }
100
+ function _arrayLikeToArray(arr, len) {
101
+ if (len == null || len > arr.length) len = arr.length;
102
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
103
+ return arr2;
104
+ }
105
+ function _nonIterableSpread() {
106
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
107
+ }
108
+ function _nonIterableRest() {
109
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
110
+ }
111
+ function _createForOfIteratorHelper(o, allowArrayLike) {
112
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
113
+ if (!it) {
114
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
115
+ if (it) o = it;
116
+ var i = 0;
117
+ var F = function () {};
118
+ return {
119
+ s: F,
120
+ n: function () {
121
+ if (i >= o.length) return {
122
+ done: true
123
+ };
124
+ return {
125
+ done: false,
126
+ value: o[i++]
127
+ };
128
+ },
129
+ e: function (e) {
130
+ throw e;
131
+ },
132
+ f: F
133
+ };
134
+ }
135
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
136
+ }
137
+ var normalCompletion = true,
138
+ didErr = false,
139
+ err;
140
+ return {
141
+ s: function () {
142
+ it = it.call(o);
143
+ },
144
+ n: function () {
145
+ var step = it.next();
146
+ normalCompletion = step.done;
147
+ return step;
148
+ },
149
+ e: function (e) {
150
+ didErr = true;
151
+ err = e;
152
+ },
153
+ f: function () {
154
+ try {
155
+ if (!normalCompletion && it.return != null) it.return();
156
+ } finally {
157
+ if (didErr) throw err;
158
+ }
159
+ }
160
+ };
161
+ }
162
+
163
+ export { _arrayLikeToArray as arrayLikeToArray, _arrayWithHoles as arrayWithHoles, _arrayWithoutHoles as arrayWithoutHoles, _createForOfIteratorHelper as createForOfIteratorHelper, _defineProperty as defineProperty, _iterableToArray as iterableToArray, _iterableToArrayLimit as iterableToArrayLimit, _nonIterableRest as nonIterableRest, _nonIterableSpread as nonIterableSpread, _objectSpread2 as objectSpread2, _slicedToArray as slicedToArray, _toConsumableArray as toConsumableArray, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey, _unsupportedIterableToArray as unsupportedIterableToArray };