@oscarpalmer/atoms 0.75.0 → 0.76.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 (215) hide show
  1. package/dist/js/array/chunk.cjs +2 -1
  2. package/dist/js/array/chunk.js +2 -1
  3. package/dist/js/array/count.cjs +10 -3
  4. package/dist/js/array/count.js +10 -3
  5. package/dist/js/array/exists.cjs +10 -3
  6. package/dist/js/array/exists.js +10 -3
  7. package/dist/js/array/filter.cjs +10 -3
  8. package/dist/js/array/filter.js +10 -3
  9. package/dist/js/array/find.cjs +10 -3
  10. package/dist/js/array/find.js +10 -3
  11. package/dist/js/array/group-by.cjs +18 -16
  12. package/dist/js/array/group-by.js +18 -16
  13. package/dist/js/array/index-of.cjs +10 -3
  14. package/dist/js/array/index-of.js +10 -3
  15. package/dist/js/array/index.cjs +2 -2
  16. package/dist/js/array/index.js +2 -2
  17. package/dist/js/array/insert.cjs +10 -4
  18. package/dist/js/array/insert.js +10 -4
  19. package/dist/js/array/splice.cjs +4 -4
  20. package/dist/js/array/splice.js +4 -4
  21. package/dist/js/array/to-map.cjs +11 -11
  22. package/dist/js/array/to-map.js +11 -11
  23. package/dist/js/array/to-record.cjs +3 -3
  24. package/dist/js/array/to-record.js +3 -3
  25. package/dist/js/array/unique.cjs +2 -2
  26. package/dist/js/array/unique.js +2 -2
  27. package/dist/js/colour/base.cjs +1 -1
  28. package/dist/js/colour/base.js +1 -1
  29. package/dist/js/colour/hex.cjs +2 -2
  30. package/dist/js/colour/hex.js +2 -2
  31. package/dist/js/colour/hsl.cjs +13 -7
  32. package/dist/js/colour/hsl.js +13 -7
  33. package/dist/js/colour/rgb.cjs +12 -6
  34. package/dist/js/colour/rgb.js +12 -6
  35. package/dist/js/emitter.cjs +8 -5
  36. package/dist/js/emitter.js +8 -5
  37. package/dist/js/function.cjs +6 -6
  38. package/dist/js/function.js +6 -6
  39. package/dist/js/index.cjs +0 -1
  40. package/dist/js/index.js +1 -2
  41. package/dist/js/internal/array/callbacks.cjs +23 -0
  42. package/dist/js/internal/array/callbacks.js +23 -0
  43. package/dist/js/internal/{array-find.cjs → array/find.cjs} +11 -12
  44. package/dist/js/internal/{array-find.js → array/find.js} +11 -12
  45. package/dist/js/logger.cjs +13 -13
  46. package/dist/js/logger.js +13 -13
  47. package/dist/js/query.cjs +0 -3
  48. package/dist/js/query.js +1 -4
  49. package/dist/js/random.cjs +0 -6
  50. package/dist/js/random.js +0 -6
  51. package/dist/js/sized.cjs +1 -1
  52. package/dist/js/sized.js +1 -1
  53. package/dist/js/string/index.cjs +7 -1
  54. package/dist/js/string/index.js +7 -1
  55. package/dist/js/value/compare.cjs +0 -1
  56. package/dist/js/value/compare.js +0 -1
  57. package/dist/js/value/get.cjs +3 -3
  58. package/dist/js/value/get.js +2 -2
  59. package/dist/js/value/set.cjs +4 -4
  60. package/dist/js/value/set.js +2 -2
  61. package/package.json +3 -2
  62. package/src/js/array/chunk.ts +6 -5
  63. package/src/js/array/compact.ts +8 -10
  64. package/src/js/array/count.ts +39 -19
  65. package/src/js/array/exists.ts +40 -16
  66. package/src/js/array/filter.ts +42 -20
  67. package/src/js/array/find.ts +45 -20
  68. package/src/js/array/group-by.ts +158 -27
  69. package/src/js/array/index-of.ts +40 -18
  70. package/src/js/array/index.ts +10 -9
  71. package/src/js/array/insert.ts +28 -14
  72. package/src/js/array/models.ts +18 -15
  73. package/src/js/array/shuffle.ts +3 -3
  74. package/src/js/array/sort.ts +28 -34
  75. package/src/js/array/splice.ts +22 -26
  76. package/src/js/array/to-map.ts +133 -45
  77. package/src/js/array/to-record.ts +137 -39
  78. package/src/js/array/unique.ts +20 -15
  79. package/src/js/colour/base.ts +3 -3
  80. package/src/js/colour/functions.ts +4 -6
  81. package/src/js/colour/hex.ts +5 -5
  82. package/src/js/colour/hsl.ts +18 -12
  83. package/src/js/colour/index.ts +1 -1
  84. package/src/js/colour/is.ts +3 -3
  85. package/src/js/colour/rgb.ts +17 -11
  86. package/src/js/emitter.ts +12 -9
  87. package/src/js/function.ts +12 -12
  88. package/src/js/index.ts +16 -16
  89. package/src/js/internal/array/callbacks.ts +33 -0
  90. package/src/js/internal/{array-find.ts → array/find.ts} +23 -24
  91. package/src/js/internal/{value-handle.ts → value/handle.ts} +1 -1
  92. package/src/js/is.ts +2 -2
  93. package/src/js/logger.ts +14 -14
  94. package/src/js/math.ts +1 -1
  95. package/src/js/models.ts +5 -5
  96. package/src/js/number.ts +2 -2
  97. package/src/js/query.ts +6 -10
  98. package/src/js/queue.ts +1 -1
  99. package/src/js/random.ts +9 -19
  100. package/src/js/sized.ts +145 -145
  101. package/src/js/string/case.ts +1 -1
  102. package/src/js/string/index.ts +13 -7
  103. package/src/js/string/template.ts +6 -3
  104. package/src/js/value/clone.ts +3 -7
  105. package/src/js/value/compare.ts +3 -5
  106. package/src/js/value/diff.ts +4 -4
  107. package/src/js/value/equal.ts +2 -2
  108. package/src/js/value/get.ts +3 -3
  109. package/src/js/value/index.ts +2 -2
  110. package/src/js/value/merge.ts +3 -3
  111. package/src/js/value/set.ts +3 -4
  112. package/src/js/value/smush.ts +4 -4
  113. package/src/js/value/unsmush.ts +4 -4
  114. package/types/array/chunk.d.cts +2 -2
  115. package/types/array/chunk.d.ts +2 -2
  116. package/types/array/compact.d.cts +4 -4
  117. package/types/array/compact.d.ts +4 -4
  118. package/types/array/count.d.cts +15 -8
  119. package/types/array/count.d.ts +13 -7
  120. package/types/array/exists.d.cts +14 -5
  121. package/types/array/exists.d.ts +12 -4
  122. package/types/array/filter.d.cts +16 -7
  123. package/types/array/filter.d.ts +14 -6
  124. package/types/array/find.d.cts +16 -7
  125. package/types/array/find.d.ts +14 -6
  126. package/types/array/group-by.d.cts +51 -5
  127. package/types/array/group-by.d.ts +49 -5
  128. package/types/array/index-of.d.cts +16 -7
  129. package/types/array/index-of.d.ts +14 -6
  130. package/types/array/index.d.cts +239 -95
  131. package/types/array/index.d.ts +7 -6
  132. package/types/array/insert.d.cts +9 -4
  133. package/types/array/insert.d.ts +10 -5
  134. package/types/array/models.d.cts +14 -11
  135. package/types/array/models.d.ts +14 -12
  136. package/types/array/shuffle.d.cts +2 -2
  137. package/types/array/shuffle.d.ts +2 -2
  138. package/types/array/sort.d.cts +11 -11
  139. package/types/array/sort.d.ts +10 -10
  140. package/types/array/splice.d.cts +4 -4
  141. package/types/array/splice.d.ts +4 -4
  142. package/types/array/to-map.d.cts +44 -20
  143. package/types/array/to-map.d.ts +42 -20
  144. package/types/array/to-record.d.cts +44 -20
  145. package/types/array/to-record.d.ts +42 -20
  146. package/types/array/unique.d.cts +11 -6
  147. package/types/array/unique.d.ts +10 -6
  148. package/types/colour/base.d.cts +28 -16
  149. package/types/colour/base.d.ts +2 -2
  150. package/types/colour/functions.d.cts +28 -16
  151. package/types/colour/functions.d.ts +3 -3
  152. package/types/colour/hex.d.cts +28 -16
  153. package/types/colour/hex.d.ts +4 -4
  154. package/types/colour/hsl.d.cts +28 -16
  155. package/types/colour/hsl.d.ts +16 -10
  156. package/types/colour/index.d.cts +28 -16
  157. package/types/colour/index.d.ts +1 -1
  158. package/types/colour/is.d.cts +28 -16
  159. package/types/colour/is.d.ts +3 -3
  160. package/types/colour/rgb.d.cts +28 -16
  161. package/types/colour/rgb.d.ts +15 -9
  162. package/types/emitter.d.cts +11 -8
  163. package/types/emitter.d.ts +11 -8
  164. package/types/function.d.cts +10 -10
  165. package/types/function.d.ts +11 -11
  166. package/types/index.d.cts +1061 -669
  167. package/types/index.d.ts +16 -16
  168. package/types/internal/array/callbacks.d.cts +11 -0
  169. package/types/internal/array/callbacks.d.ts +2 -0
  170. package/types/internal/array/find.d.cts +7 -0
  171. package/types/internal/array/find.d.ts +3 -0
  172. package/types/internal/{value-handle.d.ts → value/handle.d.ts} +1 -1
  173. package/types/is.d.ts +1 -1
  174. package/types/logger.d.cts +13 -13
  175. package/types/logger.d.ts +13 -13
  176. package/types/math.d.cts +1 -1
  177. package/types/math.d.ts +1 -1
  178. package/types/models.d.cts +4 -4
  179. package/types/models.d.ts +1 -4
  180. package/types/number.d.cts +2 -2
  181. package/types/number.d.ts +2 -2
  182. package/types/query.d.cts +2 -2
  183. package/types/query.d.ts +3 -3
  184. package/types/queue.d.cts +1 -1
  185. package/types/queue.d.ts +1 -1
  186. package/types/random.d.cts +8 -12
  187. package/types/random.d.ts +8 -12
  188. package/types/sized.d.cts +6 -6
  189. package/types/sized.d.ts +6 -6
  190. package/types/string/index.d.cts +6 -3
  191. package/types/string/index.d.ts +3 -3
  192. package/types/string/template.d.cts +3 -0
  193. package/types/string/template.d.ts +4 -1
  194. package/types/value/clone.d.cts +4 -2
  195. package/types/value/clone.d.ts +4 -2
  196. package/types/value/get.d.ts +1 -1
  197. package/types/value/index.d.cts +8 -6
  198. package/types/value/index.d.ts +2 -2
  199. package/types/value/merge.d.cts +1 -1
  200. package/types/value/merge.d.ts +2 -2
  201. package/types/value/set.d.ts +1 -1
  202. package/types/value/smush.d.cts +1 -1
  203. package/types/value/smush.d.ts +2 -2
  204. package/types/value/unsmush.d.cts +1 -1
  205. package/types/value/unsmush.d.ts +2 -2
  206. package/dist/js/internal/array-callbacks.cjs +0 -18
  207. package/dist/js/internal/array-callbacks.js +0 -18
  208. package/src/js/internal/array-callbacks.ts +0 -28
  209. package/types/internal/array-callbacks.d.cts +0 -13
  210. package/types/internal/array-callbacks.d.ts +0 -2
  211. package/types/internal/array-find.d.cts +0 -11
  212. package/types/internal/array-find.d.ts +0 -4
  213. /package/dist/js/internal/{value-handle.cjs → value/handle.cjs} +0 -0
  214. /package/dist/js/internal/{value-handle.js → value/handle.js} +0 -0
  215. /package/types/internal/{value-handle.d.cts → value/handle.d.cts} +0 -0
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const number = require("../number.cjs");
3
4
  function chunk(array, size) {
5
+ const chunkSize = number.clamp(size ?? 64e3, 1, 64e3);
4
6
  const { length } = array;
5
- const chunkSize = typeof size === "number" && size > 0 ? size : 64e3;
6
7
  if (length <= chunkSize) {
7
8
  return [array];
8
9
  }
@@ -1,6 +1,7 @@
1
+ import { clamp } from "../number.js";
1
2
  function chunk(array, size) {
3
+ const chunkSize = clamp(size ?? 64e3, 1, 64e3);
2
4
  const { length } = array;
3
- const chunkSize = typeof size === "number" && size > 0 ? size : 64e3;
4
5
  if (length <= chunkSize) {
5
6
  return [array];
6
7
  }
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_arrayFind = require("../internal/array-find.cjs");
4
- function count(array, value, key) {
5
- return internal_arrayFind.findValues("all", array, value, key).length;
3
+ const internal_array_find = require("../internal/array/find.cjs");
4
+ function count(array, ...parameters) {
5
+ const { length } = parameters;
6
+ return internal_array_find.findValues(
7
+ "all",
8
+ array,
9
+ length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
10
+ length === 2 ? parameters[0] : void 0,
11
+ length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
12
+ ).length;
6
13
  }
7
14
  exports.count = count;
@@ -1,6 +1,13 @@
1
- import { findValues } from "../internal/array-find.js";
2
- function count(array, value, key) {
3
- return findValues("all", array, value, key).length;
1
+ import { findValues } from "../internal/array/find.js";
2
+ function count(array, ...parameters) {
3
+ const { length } = parameters;
4
+ return findValues(
5
+ "all",
6
+ array,
7
+ length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
8
+ length === 2 ? parameters[0] : void 0,
9
+ length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
10
+ ).length;
4
11
  }
5
12
  export {
6
13
  count
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_arrayFind = require("../internal/array-find.cjs");
4
- function exists(array, value, key) {
5
- return internal_arrayFind.findValue("index", array, value, key) > -1;
3
+ const internal_array_find = require("../internal/array/find.cjs");
4
+ function exists(array, ...parameters) {
5
+ const { length } = parameters;
6
+ return internal_array_find.findValue(
7
+ "index",
8
+ array,
9
+ length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
10
+ length === 2 ? parameters[0] : void 0,
11
+ length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
12
+ ) > -1;
6
13
  }
7
14
  exports.exists = exists;
@@ -1,6 +1,13 @@
1
- import { findValue } from "../internal/array-find.js";
2
- function exists(array, value, key) {
3
- return findValue("index", array, value, key) > -1;
1
+ import { findValue } from "../internal/array/find.js";
2
+ function exists(array, ...parameters) {
3
+ const { length } = parameters;
4
+ return findValue(
5
+ "index",
6
+ array,
7
+ length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
8
+ length === 2 ? parameters[0] : void 0,
9
+ length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
10
+ ) > -1;
4
11
  }
5
12
  export {
6
13
  exists
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_arrayFind = require("../internal/array-find.cjs");
4
- function filter(array, value, key) {
5
- return internal_arrayFind.findValues("all", array, value, key);
3
+ const internal_array_find = require("../internal/array/find.cjs");
4
+ function filter(array, ...parameters) {
5
+ const { length } = parameters;
6
+ return internal_array_find.findValues(
7
+ "all",
8
+ array,
9
+ length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
10
+ length === 2 ? parameters[0] : void 0,
11
+ length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
12
+ );
6
13
  }
7
14
  exports.filter = filter;
@@ -1,6 +1,13 @@
1
- import { findValues } from "../internal/array-find.js";
2
- function filter(array, value, key) {
3
- return findValues("all", array, value, key);
1
+ import { findValues } from "../internal/array/find.js";
2
+ function filter(array, ...parameters) {
3
+ const { length } = parameters;
4
+ return findValues(
5
+ "all",
6
+ array,
7
+ length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
8
+ length === 2 ? parameters[0] : void 0,
9
+ length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
10
+ );
4
11
  }
5
12
  export {
6
13
  filter
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_arrayFind = require("../internal/array-find.cjs");
4
- function find(array, value, key) {
5
- return internal_arrayFind.findValue("value", array, value, key);
3
+ const internal_array_find = require("../internal/array/find.cjs");
4
+ function find(array, ...parameters) {
5
+ const { length } = parameters;
6
+ return internal_array_find.findValue(
7
+ "value",
8
+ array,
9
+ length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
10
+ length === 2 ? parameters[0] : void 0,
11
+ length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
12
+ );
6
13
  }
7
14
  exports.find = find;
@@ -1,6 +1,13 @@
1
- import { findValue } from "../internal/array-find.js";
2
- function find(array, value, key) {
3
- return findValue("value", array, value, key);
1
+ import { findValue } from "../internal/array/find.js";
2
+ function find(array, ...parameters) {
3
+ const { length } = parameters;
4
+ return findValue(
5
+ "value",
6
+ array,
7
+ length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
8
+ length === 2 ? parameters[0] : void 0,
9
+ length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
10
+ );
4
11
  }
5
12
  export {
6
13
  find
@@ -1,30 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_arrayCallbacks = require("../internal/array-callbacks.cjs");
4
- function groupBy(array, key) {
5
- return groupValues(array, key, true, false);
3
+ const internal_array_callbacks = require("../internal/array/callbacks.cjs");
4
+ function groupBy(array, first, second, third) {
5
+ return groupValues(
6
+ array,
7
+ first,
8
+ second,
9
+ first === true || second === true || third === true
10
+ );
6
11
  }
7
- function groupValues(array, key, arrays, indicable) {
8
- var _a;
9
- const callbacks = internal_arrayCallbacks.getCallbacks(void 0, key);
10
- const hasCallback = typeof (callbacks == null ? void 0 : callbacks.key) === "function";
11
- if (!hasCallback && !indicable) {
12
- return {};
13
- }
12
+ function groupValues(array, key, value, arrays) {
13
+ var _a, _b;
14
+ const callbacks = internal_array_callbacks.getCallbacks(void 0, key, value);
14
15
  const record = {};
15
16
  const { length } = array;
16
17
  for (let index = 0; index < length; index += 1) {
17
- const value = array[index];
18
- const key2 = hasCallback ? ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, value, index, array)) ?? index : index;
18
+ const item = array[index];
19
+ const key2 = ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, item, index, array)) ?? index;
20
+ const value2 = ((_b = callbacks == null ? void 0 : callbacks.value) == null ? void 0 : _b.call(callbacks, item, index, array)) ?? item;
19
21
  if (arrays) {
20
22
  const existing = record[key2];
21
- if (Array.isArray(existing)) {
22
- existing.push(value);
23
+ if (existing == null) {
24
+ record[key2] = [value2];
23
25
  } else {
24
- record[key2] = [value];
26
+ existing.push(value2);
25
27
  }
26
28
  } else {
27
- record[key2] = value;
29
+ record[key2] = value2;
28
30
  }
29
31
  }
30
32
  return record;
@@ -1,28 +1,30 @@
1
- import { getCallbacks } from "../internal/array-callbacks.js";
2
- function groupBy(array, key) {
3
- return groupValues(array, key, true, false);
1
+ import { getCallbacks } from "../internal/array/callbacks.js";
2
+ function groupBy(array, first, second, third) {
3
+ return groupValues(
4
+ array,
5
+ first,
6
+ second,
7
+ first === true || second === true || third === true
8
+ );
4
9
  }
5
- function groupValues(array, key, arrays, indicable) {
6
- var _a;
7
- const callbacks = getCallbacks(void 0, key);
8
- const hasCallback = typeof (callbacks == null ? void 0 : callbacks.key) === "function";
9
- if (!hasCallback && !indicable) {
10
- return {};
11
- }
10
+ function groupValues(array, key, value, arrays) {
11
+ var _a, _b;
12
+ const callbacks = getCallbacks(void 0, key, value);
12
13
  const record = {};
13
14
  const { length } = array;
14
15
  for (let index = 0; index < length; index += 1) {
15
- const value = array[index];
16
- const key2 = hasCallback ? ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, value, index, array)) ?? index : index;
16
+ const item = array[index];
17
+ const key2 = ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, item, index, array)) ?? index;
18
+ const value2 = ((_b = callbacks == null ? void 0 : callbacks.value) == null ? void 0 : _b.call(callbacks, item, index, array)) ?? item;
17
19
  if (arrays) {
18
20
  const existing = record[key2];
19
- if (Array.isArray(existing)) {
20
- existing.push(value);
21
+ if (existing == null) {
22
+ record[key2] = [value2];
21
23
  } else {
22
- record[key2] = [value];
24
+ existing.push(value2);
23
25
  }
24
26
  } else {
25
- record[key2] = value;
27
+ record[key2] = value2;
26
28
  }
27
29
  }
28
30
  return record;
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_arrayFind = require("../internal/array-find.cjs");
4
- function indexOf(array, value, key) {
5
- return internal_arrayFind.findValue("index", array, value, key);
3
+ const internal_array_find = require("../internal/array/find.cjs");
4
+ function indexOf(array, ...parameters) {
5
+ const { length } = parameters;
6
+ return internal_array_find.findValue(
7
+ "index",
8
+ array,
9
+ length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
10
+ length === 2 ? parameters[0] : void 0,
11
+ length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
12
+ );
6
13
  }
7
14
  exports.indexOf = indexOf;
@@ -1,6 +1,13 @@
1
- import { findValue } from "../internal/array-find.js";
2
- function indexOf(array, value, key) {
3
- return findValue("index", array, value, key);
1
+ import { findValue } from "../internal/array/find.js";
2
+ function indexOf(array, ...parameters) {
3
+ const { length } = parameters;
4
+ return findValue(
5
+ "index",
6
+ array,
7
+ length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
8
+ length === 2 ? parameters[0] : void 0,
9
+ length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
10
+ );
4
11
  }
5
12
  export {
6
13
  indexOf
@@ -18,8 +18,8 @@ const array_unique = require("./unique.cjs");
18
18
  function flatten(array) {
19
19
  return array.flat(Number.POSITIVE_INFINITY);
20
20
  }
21
- function push(array, values) {
22
- return array_insert.insertValues("push", array, values, array.length, 0);
21
+ function push(array, pushed) {
22
+ return array_insert.insertValues("push", array, pushed, array.length, 0);
23
23
  }
24
24
  exports.insert = array_insert.insert;
25
25
  exports.chunk = array_chunk.chunk;
@@ -17,8 +17,8 @@ import { unique } from "./unique.js";
17
17
  function flatten(array) {
18
18
  return array.flat(Number.POSITIVE_INFINITY);
19
19
  }
20
- function push(array, values) {
21
- return insertValues("push", array, values, array.length, 0);
20
+ function push(array, pushed) {
21
+ return insertValues("push", array, pushed, array.length, 0);
22
22
  }
23
23
  export {
24
24
  chunk,
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const array_chunk = require("./chunk.cjs");
4
- function insert(array, index, values) {
5
- insertValues("splice", array, values, index, 0);
4
+ function insert(array, first, second) {
5
+ insertValues(
6
+ "splice",
7
+ array,
8
+ Array.isArray(first) ? first : second ?? [],
9
+ typeof first === "number" ? first : array.length,
10
+ 0
11
+ );
6
12
  }
7
- function insertValues(type, array, values, start, deleteCount) {
8
- const chunked = array_chunk.chunk(values);
13
+ function insertValues(type, array, items, start, deleteCount) {
14
+ const chunked = array_chunk.chunk(items);
9
15
  const lastIndex = chunked.length - 1;
10
16
  let index = Number(chunked.length);
11
17
  let returned;
@@ -1,9 +1,15 @@
1
1
  import { chunk } from "./chunk.js";
2
- function insert(array, index, values) {
3
- insertValues("splice", array, values, index, 0);
2
+ function insert(array, first, second) {
3
+ insertValues(
4
+ "splice",
5
+ array,
6
+ Array.isArray(first) ? first : second ?? [],
7
+ typeof first === "number" ? first : array.length,
8
+ 0
9
+ );
4
10
  }
5
- function insertValues(type, array, values, start, deleteCount) {
6
- const chunked = chunk(values);
11
+ function insertValues(type, array, items, start, deleteCount) {
12
+ const chunked = chunk(items);
7
13
  const lastIndex = chunked.length - 1;
8
14
  let index = Number(chunked.length);
9
15
  let returned;
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const array_insert = require("./insert.cjs");
4
- function splice(array, start, amountOrValues, values) {
5
- const amoutOrValuesIsArray = Array.isArray(amountOrValues);
4
+ function splice(array, start, first, second) {
5
+ const isArray = Array.isArray(first);
6
6
  return array_insert.insertValues(
7
7
  "splice",
8
8
  array,
9
- amoutOrValuesIsArray ? amountOrValues : values ?? [],
9
+ isArray ? first : second ?? [],
10
10
  start,
11
- amoutOrValuesIsArray ? array.length : typeof amountOrValues === "number" && amountOrValues > 0 ? amountOrValues : 0
11
+ isArray ? array.length : typeof first === "number" && first > 0 ? first : 0
12
12
  );
13
13
  }
14
14
  exports.splice = splice;
@@ -1,12 +1,12 @@
1
1
  import { insertValues } from "./insert.js";
2
- function splice(array, start, amountOrValues, values) {
3
- const amoutOrValuesIsArray = Array.isArray(amountOrValues);
2
+ function splice(array, start, first, second) {
3
+ const isArray = Array.isArray(first);
4
4
  return insertValues(
5
5
  "splice",
6
6
  array,
7
- amoutOrValuesIsArray ? amountOrValues : values ?? [],
7
+ isArray ? first : second ?? [],
8
8
  start,
9
- amoutOrValuesIsArray ? array.length : typeof amountOrValues === "number" && amountOrValues > 0 ? amountOrValues : 0
9
+ isArray ? array.length : typeof first === "number" && first > 0 ? first : 0
10
10
  );
11
11
  }
12
12
  export {
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_arrayCallbacks = require("../internal/array-callbacks.cjs");
4
- function toMap(array, first, second) {
5
- var _a;
6
- const asArrays = first === true || second === true;
7
- const callbacks = internal_arrayCallbacks.getCallbacks(void 0, first);
8
- const hasCallback = typeof (callbacks == null ? void 0 : callbacks.key) === "function";
3
+ const internal_array_callbacks = require("../internal/array/callbacks.cjs");
4
+ function toMap(array, first, second, third) {
5
+ var _a, _b;
6
+ const asArrays = first === true || second === true || third === true;
7
+ const callbacks = internal_array_callbacks.getCallbacks(void 0, first, second);
9
8
  const map = /* @__PURE__ */ new Map();
10
9
  const { length } = array;
11
10
  for (let index = 0; index < length; index += 1) {
12
- const value = array[index];
13
- const key = hasCallback ? ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, value, index, array)) ?? index : index;
11
+ const item = array[index];
12
+ const key = ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, item, index, array)) ?? index;
13
+ const value = ((_b = callbacks == null ? void 0 : callbacks.value) == null ? void 0 : _b.call(callbacks, item, index, array)) ?? item;
14
14
  if (asArrays) {
15
15
  const existing = map.get(key);
16
- if (Array.isArray(existing)) {
17
- existing.push(value);
18
- } else {
16
+ if (existing == null) {
19
17
  map.set(key, [value]);
18
+ } else {
19
+ existing.push(value);
20
20
  }
21
21
  } else {
22
22
  map.set(key, value);
@@ -1,20 +1,20 @@
1
- import { getCallbacks } from "../internal/array-callbacks.js";
2
- function toMap(array, first, second) {
3
- var _a;
4
- const asArrays = first === true || second === true;
5
- const callbacks = getCallbacks(void 0, first);
6
- const hasCallback = typeof (callbacks == null ? void 0 : callbacks.key) === "function";
1
+ import { getCallbacks } from "../internal/array/callbacks.js";
2
+ function toMap(array, first, second, third) {
3
+ var _a, _b;
4
+ const asArrays = first === true || second === true || third === true;
5
+ const callbacks = getCallbacks(void 0, first, second);
7
6
  const map = /* @__PURE__ */ new Map();
8
7
  const { length } = array;
9
8
  for (let index = 0; index < length; index += 1) {
10
- const value = array[index];
11
- const key = hasCallback ? ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, value, index, array)) ?? index : index;
9
+ const item = array[index];
10
+ const key = ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, item, index, array)) ?? index;
11
+ const value = ((_b = callbacks == null ? void 0 : callbacks.value) == null ? void 0 : _b.call(callbacks, item, index, array)) ?? item;
12
12
  if (asArrays) {
13
13
  const existing = map.get(key);
14
- if (Array.isArray(existing)) {
15
- existing.push(value);
16
- } else {
14
+ if (existing == null) {
17
15
  map.set(key, [value]);
16
+ } else {
17
+ existing.push(value);
18
18
  }
19
19
  } else {
20
20
  map.set(key, value);
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const array_groupBy = require("./group-by.cjs");
4
- function toRecord(array, first, second) {
4
+ function toRecord(array, first, second, third) {
5
5
  return array_groupBy.groupValues(
6
6
  array,
7
7
  first,
8
- first === true || second === true,
9
- true
8
+ second,
9
+ first === true || second === true || third === true
10
10
  );
11
11
  }
12
12
  exports.toRecord = toRecord;
@@ -1,10 +1,10 @@
1
1
  import { groupValues } from "./group-by.js";
2
- function toRecord(array, first, second) {
2
+ function toRecord(array, first, second, third) {
3
3
  return groupValues(
4
4
  array,
5
5
  first,
6
- first === true || second === true,
7
- true
6
+ second,
7
+ first === true || second === true || third === true
8
8
  );
9
9
  }
10
10
  export {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_arrayFind = require("../internal/array-find.cjs");
3
+ const internal_array_find = require("../internal/array/find.cjs");
4
4
  function unique(array, key) {
5
- return internal_arrayFind.findValues("unique", array, void 0, key);
5
+ return internal_array_find.findValues("unique", array, void 0, key, void 0);
6
6
  }
7
7
  exports.unique = unique;
@@ -1,6 +1,6 @@
1
- import { findValues } from "../internal/array-find.js";
1
+ import { findValues } from "../internal/array/find.js";
2
2
  function unique(array, key) {
3
- return findValues("unique", array, void 0, key);
3
+ return findValues("unique", array, void 0, key, void 0);
4
4
  }
5
5
  export {
6
6
  unique
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const colour_is = require("./is.cjs");
4
4
  class Colour {
5
5
  /**
6
- * Gets the current value of the colour
6
+ * Get the current value of the colour
7
7
  */
8
8
  get value() {
9
9
  return { ...this.state.value };
@@ -1,7 +1,7 @@
1
1
  import { isColourValue } from "./is.js";
2
2
  class Colour {
3
3
  /**
4
- * Gets the current value of the colour
4
+ * Get the current value of the colour
5
5
  */
6
6
  get value() {
7
7
  return { ...this.state.value };
@@ -13,13 +13,13 @@ class HexColour {
13
13
  };
14
14
  }
15
15
  /**
16
- * Gets the value of the colour
16
+ * Get the value of the colour
17
17
  */
18
18
  get value() {
19
19
  return `#${this.state.value}`;
20
20
  }
21
21
  /**
22
- * Sets the value of the colour
22
+ * Set the value of the colour
23
23
  */
24
24
  set value(value) {
25
25
  this.state.value = colour_functions.anyPattern.test(value) ? colour_functions.getNormalisedHex(value) : "000000";
@@ -11,13 +11,13 @@ class HexColour {
11
11
  };
12
12
  }
13
13
  /**
14
- * Gets the value of the colour
14
+ * Get the value of the colour
15
15
  */
16
16
  get value() {
17
17
  return `#${this.state.value}`;
18
18
  }
19
19
  /**
20
- * Sets the value of the colour
20
+ * Set the value of the colour
21
21
  */
22
22
  set value(value) {
23
23
  this.state.value = anyPattern.test(value) ? getNormalisedHex(value) : "000000";