@oscarpalmer/atoms 0.90.0 → 0.92.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 (164) hide show
  1. package/dist/array/chunk.cjs +5 -2
  2. package/dist/array/chunk.js +2 -3
  3. package/dist/array/compact.cjs +5 -2
  4. package/dist/array/compact.js +2 -3
  5. package/dist/array/count.cjs +8 -5
  6. package/dist/array/count.js +5 -6
  7. package/dist/array/exists.cjs +7 -3
  8. package/dist/array/exists.js +4 -4
  9. package/dist/array/filter.cjs +7 -3
  10. package/dist/array/filter.js +4 -4
  11. package/dist/array/find.cjs +7 -3
  12. package/dist/array/find.js +4 -4
  13. package/dist/array/group-by.cjs +9 -6
  14. package/dist/array/group-by.js +6 -8
  15. package/dist/array/index-of.cjs +7 -3
  16. package/dist/array/index-of.js +4 -4
  17. package/dist/array/index.cjs +21 -17
  18. package/dist/array/index.js +19 -35
  19. package/dist/array/insert.cjs +8 -4
  20. package/dist/array/insert.js +5 -6
  21. package/dist/array/models.cjs +2 -1
  22. package/dist/array/shuffle.cjs +7 -3
  23. package/dist/array/shuffle.js +4 -4
  24. package/dist/array/sort.cjs +10 -6
  25. package/dist/array/sort.js +7 -7
  26. package/dist/array/splice.cjs +7 -3
  27. package/dist/array/splice.js +4 -4
  28. package/dist/array/to-map.cjs +9 -6
  29. package/dist/array/to-map.js +6 -7
  30. package/dist/array/to-record.cjs +7 -3
  31. package/dist/array/to-record.js +4 -4
  32. package/dist/array/unique.cjs +7 -3
  33. package/dist/array/unique.js +4 -4
  34. package/dist/color.cjs +276 -0
  35. package/dist/color.js +263 -0
  36. package/dist/emitter.cjs +15 -15
  37. package/dist/emitter.js +12 -16
  38. package/dist/function.cjs +18 -19
  39. package/dist/function.js +14 -22
  40. package/dist/i18n.cjs +8 -6
  41. package/dist/i18n.js +5 -7
  42. package/dist/index.cjs +72 -77
  43. package/dist/index.js +42 -144
  44. package/dist/internal/array/callbacks.cjs +5 -2
  45. package/dist/internal/array/callbacks.js +2 -3
  46. package/dist/internal/array/find.cjs +12 -10
  47. package/dist/internal/array/find.js +9 -12
  48. package/dist/internal/math/aggregate.cjs +5 -2
  49. package/dist/internal/math/aggregate.js +2 -3
  50. package/dist/internal/string/key.cjs +5 -2
  51. package/dist/internal/string/key.js +2 -3
  52. package/dist/internal/value/handle.cjs +7 -3
  53. package/dist/internal/value/handle.js +4 -4
  54. package/dist/internal/value/paths.cjs +5 -2
  55. package/dist/internal/value/paths.js +2 -3
  56. package/dist/is.cjs +9 -5
  57. package/dist/is.js +4 -15
  58. package/dist/logger.cjs +7 -3
  59. package/dist/logger.js +4 -4
  60. package/dist/math.cjs +7 -3
  61. package/dist/math.js +4 -8
  62. package/dist/models.cjs +2 -1
  63. package/dist/number.cjs +5 -2
  64. package/dist/number.js +2 -5
  65. package/dist/query.cjs +13 -9
  66. package/dist/query.js +7 -8
  67. package/dist/random.cjs +7 -3
  68. package/dist/random.js +4 -11
  69. package/dist/schema.cjs +5 -2
  70. package/dist/schema.js +2 -3
  71. package/dist/sized.cjs +33 -32
  72. package/dist/sized.js +30 -34
  73. package/dist/string/case.cjs +13 -9
  74. package/dist/string/case.js +6 -11
  75. package/dist/string/index.cjs +16 -58
  76. package/dist/string/index.js +3 -65
  77. package/dist/string/misc.cjs +59 -0
  78. package/dist/string/misc.js +50 -0
  79. package/dist/string/template.cjs +11 -7
  80. package/dist/string/template.js +7 -7
  81. package/dist/touch.cjs +4 -2
  82. package/dist/touch.js +3 -4
  83. package/dist/value/clone.cjs +8 -4
  84. package/dist/value/clone.js +5 -5
  85. package/dist/value/compare.cjs +12 -8
  86. package/dist/value/compare.js +5 -5
  87. package/dist/value/diff.cjs +13 -9
  88. package/dist/value/diff.js +8 -8
  89. package/dist/value/equal.cjs +7 -3
  90. package/dist/value/equal.js +4 -4
  91. package/dist/value/get.cjs +8 -4
  92. package/dist/value/get.js +5 -5
  93. package/dist/value/index.cjs +15 -11
  94. package/dist/value/index.js +12 -21
  95. package/dist/value/merge.cjs +8 -4
  96. package/dist/value/merge.js +5 -5
  97. package/dist/value/set.cjs +8 -4
  98. package/dist/value/set.js +5 -5
  99. package/dist/value/smush.cjs +11 -7
  100. package/dist/value/smush.js +5 -5
  101. package/dist/value/unsmush.cjs +8 -4
  102. package/dist/value/unsmush.js +5 -5
  103. package/package.json +7 -7
  104. package/src/color.ts +432 -0
  105. package/src/function.ts +1 -1
  106. package/src/index.ts +1 -1
  107. package/src/is.ts +1 -1
  108. package/src/query.ts +1 -1
  109. package/src/string/case.ts +1 -1
  110. package/src/string/index.ts +1 -95
  111. package/src/string/misc.ts +94 -0
  112. package/src/string/template.ts +1 -1
  113. package/src/value/compare.ts +1 -1
  114. package/src/value/diff.ts +1 -1
  115. package/src/value/smush.ts +1 -1
  116. package/types/color.d.cts +73 -0
  117. package/types/color.d.ts +69 -0
  118. package/types/index.d.cts +83 -220
  119. package/types/index.d.ts +1 -1
  120. package/types/models.d.cts +41 -40
  121. package/types/schema.d.cts +40 -39
  122. package/types/string/index.d.cts +14 -14
  123. package/types/string/index.d.ts +1 -26
  124. package/types/string/misc.d.cts +30 -0
  125. package/types/string/misc.d.ts +26 -0
  126. package/types/value/get.d.cts +41 -40
  127. package/types/value/index.d.cts +41 -40
  128. package/types/value/set.d.cts +41 -40
  129. package/types/value/smush.d.cts +41 -40
  130. package/dist/color/base.cjs +0 -43
  131. package/dist/color/base.js +0 -43
  132. package/dist/color/functions.cjs +0 -96
  133. package/dist/color/functions.js +0 -96
  134. package/dist/color/hex.cjs +0 -56
  135. package/dist/color/hex.js +0 -56
  136. package/dist/color/hsl.cjs +0 -75
  137. package/dist/color/hsl.js +0 -75
  138. package/dist/color/index.cjs +0 -34
  139. package/dist/color/index.js +0 -34
  140. package/dist/color/is.cjs +0 -27
  141. package/dist/color/is.js +0 -27
  142. package/dist/color/rgb.cjs +0 -81
  143. package/dist/color/rgb.js +0 -81
  144. package/src/color/base.ts +0 -79
  145. package/src/color/functions.ts +0 -137
  146. package/src/color/hex.ts +0 -74
  147. package/src/color/hsl.ts +0 -94
  148. package/src/color/index.ts +0 -29
  149. package/src/color/is.ts +0 -54
  150. package/src/color/rgb.ts +0 -101
  151. package/types/color/base.d.cts +0 -161
  152. package/types/color/base.d.ts +0 -32
  153. package/types/color/functions.d.cts +0 -181
  154. package/types/color/functions.d.ts +0 -23
  155. package/types/color/hex.d.cts +0 -165
  156. package/types/color/hex.d.ts +0 -35
  157. package/types/color/hsl.d.cts +0 -165
  158. package/types/color/hsl.d.ts +0 -55
  159. package/types/color/index.d.cts +0 -211
  160. package/types/color/index.d.ts +0 -10
  161. package/types/color/is.d.cts +0 -178
  162. package/types/color/is.d.ts +0 -20
  163. package/types/color/rgb.d.cts +0 -165
  164. package/types/color/rgb.d.ts +0 -59
@@ -1,5 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
3
5
  function chunk(array, size) {
4
6
  if (!Array.isArray(array)) {
5
7
  return [];
@@ -20,4 +22,5 @@ function chunk(array, size) {
20
22
  }
21
23
  return chunks;
22
24
  }
25
+
23
26
  exports.chunk = chunk;
@@ -18,6 +18,5 @@ function chunk(array, size) {
18
18
  }
19
19
  return chunks;
20
20
  }
21
- export {
22
- chunk
23
- };
21
+
22
+ export { chunk };
@@ -1,5 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
3
5
  function compact(array, strict) {
4
6
  if (!Array.isArray(array)) {
5
7
  return [];
@@ -15,4 +17,5 @@ function compact(array, strict) {
15
17
  }
16
18
  return compacted;
17
19
  }
20
+
18
21
  exports.compact = compact;
@@ -13,6 +13,5 @@ function compact(array, strict) {
13
13
  }
14
14
  return compacted;
15
15
  }
16
- export {
17
- compact
18
- };
16
+
17
+ export { compact };
@@ -1,8 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_array_find = require("../internal/array/find.cjs");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const internal_array_find = require('../internal/array/find.cjs');
6
+
4
7
  function count(array, ...parameters) {
5
- var _a;
6
8
  if (Array.isArray(parameters) && parameters.length === 1 && typeof parameters[0] !== "function") {
7
9
  if (!Array.isArray(array)) {
8
10
  return Number.NaN;
@@ -18,6 +20,7 @@ function count(array, ...parameters) {
18
20
  }
19
21
  return result;
20
22
  }
21
- return ((_a = internal_array_find.findValues("all", array, parameters, true)) == null ? void 0 : _a.length) ?? Number.NaN;
23
+ return internal_array_find.findValues("all", array, parameters, true)?.length ?? Number.NaN;
22
24
  }
25
+
23
26
  exports.count = count;
@@ -1,6 +1,6 @@
1
- import { findValues } from "../internal/array/find.js";
1
+ import { findValues } from '../internal/array/find.js';
2
+
2
3
  function count(array, ...parameters) {
3
- var _a;
4
4
  if (Array.isArray(parameters) && parameters.length === 1 && typeof parameters[0] !== "function") {
5
5
  if (!Array.isArray(array)) {
6
6
  return Number.NaN;
@@ -16,8 +16,7 @@ function count(array, ...parameters) {
16
16
  }
17
17
  return result;
18
18
  }
19
- return ((_a = findValues("all", array, parameters, true)) == null ? void 0 : _a.length) ?? Number.NaN;
19
+ return findValues("all", array, parameters, true)?.length ?? Number.NaN;
20
20
  }
21
- export {
22
- count
23
- };
21
+
22
+ export { count };
@@ -1,10 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_array_find = require("../internal/array/find.cjs");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const internal_array_find = require('../internal/array/find.cjs');
6
+
4
7
  function exists(array, ...parameters) {
5
8
  if (parameters.length === 1 && typeof parameters[0] !== "function") {
6
9
  return Array.isArray(array) ? array.includes(parameters[0]) : false;
7
10
  }
8
11
  return internal_array_find.findValue("index", array, parameters) > -1;
9
12
  }
13
+
10
14
  exports.exists = exists;
@@ -1,10 +1,10 @@
1
- import { findValue } from "../internal/array/find.js";
1
+ import { findValue } from '../internal/array/find.js';
2
+
2
3
  function exists(array, ...parameters) {
3
4
  if (parameters.length === 1 && typeof parameters[0] !== "function") {
4
5
  return Array.isArray(array) ? array.includes(parameters[0]) : false;
5
6
  }
6
7
  return findValue("index", array, parameters) > -1;
7
8
  }
8
- export {
9
- exists
10
- };
9
+
10
+ export { exists };
@@ -1,7 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_array_find = require("../internal/array/find.cjs");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const internal_array_find = require('../internal/array/find.cjs');
6
+
4
7
  function filter(array, ...parameters) {
5
8
  return internal_array_find.findValues("all", array, parameters);
6
9
  }
10
+
7
11
  exports.filter = filter;
@@ -1,7 +1,7 @@
1
- import { findValues } from "../internal/array/find.js";
1
+ import { findValues } from '../internal/array/find.js';
2
+
2
3
  function filter(array, ...parameters) {
3
4
  return findValues("all", array, parameters);
4
5
  }
5
- export {
6
- filter
7
- };
6
+
7
+ export { filter };
@@ -1,7 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_array_find = require("../internal/array/find.cjs");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const internal_array_find = require('../internal/array/find.cjs');
6
+
4
7
  function find(array, ...parameters) {
5
8
  return internal_array_find.findValue("value", array, parameters);
6
9
  }
10
+
7
11
  exports.find = find;
@@ -1,7 +1,7 @@
1
- import { findValue } from "../internal/array/find.js";
1
+ import { findValue } from '../internal/array/find.js';
2
+
2
3
  function find(array, ...parameters) {
3
4
  return findValue("value", array, parameters);
4
5
  }
5
- export {
6
- find
7
- };
6
+
7
+ export { find };
@@ -1,6 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_array_callbacks = require("../internal/array/callbacks.cjs");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const internal_array_callbacks = require('../internal/array/callbacks.cjs');
6
+
4
7
  function groupBy(array, key, valueOrArrays, arrays) {
5
8
  return groupValues(
6
9
  array,
@@ -10,7 +13,6 @@ function groupBy(array, key, valueOrArrays, arrays) {
10
13
  );
11
14
  }
12
15
  function groupValues(array, key, value, arrays) {
13
- var _a, _b;
14
16
  if (!Array.isArray(array) || array.length === 0) {
15
17
  return {};
16
18
  }
@@ -19,8 +21,8 @@ function groupValues(array, key, value, arrays) {
19
21
  const { length } = array;
20
22
  for (let index = 0; index < length; index += 1) {
21
23
  const item = array[index];
22
- const keyed = ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, item, index, array)) ?? index;
23
- const valued = ((_b = callbacks == null ? void 0 : callbacks.value) == null ? void 0 : _b.call(callbacks, item, index, array)) ?? item;
24
+ const keyed = callbacks?.key?.(item, index, array) ?? index;
25
+ const valued = callbacks?.value?.(item, index, array) ?? item;
24
26
  if (arrays) {
25
27
  const existing = record[keyed];
26
28
  if (existing == null) {
@@ -34,5 +36,6 @@ function groupValues(array, key, value, arrays) {
34
36
  }
35
37
  return record;
36
38
  }
39
+
37
40
  exports.groupBy = groupBy;
38
41
  exports.groupValues = groupValues;
@@ -1,4 +1,5 @@
1
- import { getCallbacks } from "../internal/array/callbacks.js";
1
+ import { getCallbacks } from '../internal/array/callbacks.js';
2
+
2
3
  function groupBy(array, key, valueOrArrays, arrays) {
3
4
  return groupValues(
4
5
  array,
@@ -8,7 +9,6 @@ function groupBy(array, key, valueOrArrays, arrays) {
8
9
  );
9
10
  }
10
11
  function groupValues(array, key, value, arrays) {
11
- var _a, _b;
12
12
  if (!Array.isArray(array) || array.length === 0) {
13
13
  return {};
14
14
  }
@@ -17,8 +17,8 @@ function groupValues(array, key, value, arrays) {
17
17
  const { length } = array;
18
18
  for (let index = 0; index < length; index += 1) {
19
19
  const item = array[index];
20
- const keyed = ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, item, index, array)) ?? index;
21
- const valued = ((_b = callbacks == null ? void 0 : callbacks.value) == null ? void 0 : _b.call(callbacks, item, index, array)) ?? item;
20
+ const keyed = callbacks?.key?.(item, index, array) ?? index;
21
+ const valued = callbacks?.value?.(item, index, array) ?? item;
22
22
  if (arrays) {
23
23
  const existing = record[keyed];
24
24
  if (existing == null) {
@@ -32,7 +32,5 @@ function groupValues(array, key, value, arrays) {
32
32
  }
33
33
  return record;
34
34
  }
35
- export {
36
- groupBy,
37
- groupValues
38
- };
35
+
36
+ export { groupBy, groupValues };
@@ -1,7 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_array_find = require("../internal/array/find.cjs");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const internal_array_find = require('../internal/array/find.cjs');
6
+
4
7
  function indexOf(array, ...parameters) {
5
8
  return internal_array_find.findValue("index", array, parameters);
6
9
  }
10
+
7
11
  exports.indexOf = indexOf;
@@ -1,7 +1,7 @@
1
- import { findValue } from "../internal/array/find.js";
1
+ import { findValue } from '../internal/array/find.js';
2
+
2
3
  function indexOf(array, ...parameters) {
3
4
  return findValue("index", array, parameters);
4
5
  }
5
- export {
6
- indexOf
7
- };
6
+
7
+ export { indexOf };
@@ -1,20 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const array_insert = require("./insert.cjs");
4
- const array_chunk = require("./chunk.cjs");
5
- const array_compact = require("./compact.cjs");
6
- const array_count = require("./count.cjs");
7
- const array_exists = require("./exists.cjs");
8
- const array_filter = require("./filter.cjs");
9
- const array_find = require("./find.cjs");
10
- const array_groupBy = require("./group-by.cjs");
11
- const array_indexOf = require("./index-of.cjs");
12
- const array_shuffle = require("./shuffle.cjs");
13
- const array_sort = require("./sort.cjs");
14
- const array_splice = require("./splice.cjs");
15
- const array_toMap = require("./to-map.cjs");
16
- const array_toRecord = require("./to-record.cjs");
17
- const array_unique = require("./unique.cjs");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const array_insert = require('./insert.cjs');
6
+ const array_chunk = require('./chunk.cjs');
7
+ const array_compact = require('./compact.cjs');
8
+ const array_count = require('./count.cjs');
9
+ const array_exists = require('./exists.cjs');
10
+ const array_filter = require('./filter.cjs');
11
+ const array_find = require('./find.cjs');
12
+ const array_groupBy = require('./group-by.cjs');
13
+ const array_indexOf = require('./index-of.cjs');
14
+ const array_shuffle = require('./shuffle.cjs');
15
+ const array_sort = require('./sort.cjs');
16
+ const array_splice = require('./splice.cjs');
17
+ const array_toMap = require('./to-map.cjs');
18
+ const array_toRecord = require('./to-record.cjs');
19
+ const array_unique = require('./unique.cjs');
20
+
18
21
  function flatten(array) {
19
22
  if (!Array.isArray(array)) {
20
23
  return [];
@@ -24,6 +27,7 @@ function flatten(array) {
24
27
  function push(array, pushed) {
25
28
  return array_insert.insertValues("push", array, pushed, array.length, 0);
26
29
  }
30
+
27
31
  exports.insert = array_insert.insert;
28
32
  exports.chunk = array_chunk.chunk;
29
33
  exports.compact = array_compact.compact;
@@ -1,19 +1,20 @@
1
- import { insertValues } from "./insert.js";
2
- import { insert } from "./insert.js";
3
- import { chunk } from "./chunk.js";
4
- import { compact } from "./compact.js";
5
- import { count } from "./count.js";
6
- import { exists } from "./exists.js";
7
- import { filter } from "./filter.js";
8
- import { find } from "./find.js";
9
- import { groupBy } from "./group-by.js";
10
- import { indexOf } from "./index-of.js";
11
- import { shuffle } from "./shuffle.js";
12
- import { sort } from "./sort.js";
13
- import { splice } from "./splice.js";
14
- import { toMap } from "./to-map.js";
15
- import { toRecord } from "./to-record.js";
16
- import { unique } from "./unique.js";
1
+ import { insertValues } from './insert.js';
2
+ export { insert } from './insert.js';
3
+ export { chunk } from './chunk.js';
4
+ export { compact } from './compact.js';
5
+ export { count } from './count.js';
6
+ export { exists } from './exists.js';
7
+ export { filter } from './filter.js';
8
+ export { find } from './find.js';
9
+ export { groupBy } from './group-by.js';
10
+ export { indexOf } from './index-of.js';
11
+ export { shuffle } from './shuffle.js';
12
+ export { sort } from './sort.js';
13
+ export { splice } from './splice.js';
14
+ export { toMap } from './to-map.js';
15
+ export { toRecord } from './to-record.js';
16
+ export { unique } from './unique.js';
17
+
17
18
  function flatten(array) {
18
19
  if (!Array.isArray(array)) {
19
20
  return [];
@@ -23,22 +24,5 @@ function flatten(array) {
23
24
  function push(array, pushed) {
24
25
  return insertValues("push", array, pushed, array.length, 0);
25
26
  }
26
- export {
27
- chunk,
28
- compact,
29
- count,
30
- exists,
31
- filter,
32
- find,
33
- flatten,
34
- groupBy,
35
- indexOf,
36
- insert,
37
- push,
38
- shuffle,
39
- sort,
40
- splice,
41
- toMap,
42
- toRecord,
43
- unique
44
- };
27
+
28
+ export { flatten, push };
@@ -1,12 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const array_chunk = require("./chunk.cjs");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const array_chunk = require('./chunk.cjs');
6
+
4
7
  function insert(array, indexOrItems, items) {
5
8
  return insertValues(
6
9
  "insert",
7
10
  array,
8
11
  items == null ? indexOrItems : items,
9
- typeof indexOrItems === "number" ? indexOrItems : array == null ? void 0 : array.length,
12
+ typeof indexOrItems === "number" ? indexOrItems : array?.length,
10
13
  0
11
14
  );
12
15
  }
@@ -35,5 +38,6 @@ function insertValues(type, array, items, start, deleteCount) {
35
38
  }
36
39
  return type === "insert" ? array : type === "splice" ? returned : array.length;
37
40
  }
41
+
38
42
  exports.insert = insert;
39
43
  exports.insertValues = insertValues;
@@ -1,10 +1,11 @@
1
- import { chunk } from "./chunk.js";
1
+ import { chunk } from './chunk.js';
2
+
2
3
  function insert(array, indexOrItems, items) {
3
4
  return insertValues(
4
5
  "insert",
5
6
  array,
6
7
  items == null ? indexOrItems : items,
7
- typeof indexOrItems === "number" ? indexOrItems : array == null ? void 0 : array.length,
8
+ typeof indexOrItems === "number" ? indexOrItems : array?.length,
8
9
  0
9
10
  );
10
11
  }
@@ -33,7 +34,5 @@ function insertValues(type, array, items, start, deleteCount) {
33
34
  }
34
35
  return type === "insert" ? array : type === "splice" ? returned : array.length;
35
36
  }
36
- export {
37
- insert,
38
- insertValues
39
- };
37
+
38
+ export { insert, insertValues };
@@ -1 +1,2 @@
1
- "use strict";
1
+ 'use strict';
2
+
@@ -1,6 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const random = require("../random.cjs");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const random = require('../random.cjs');
6
+
4
7
  function shuffle(array) {
5
8
  if (!Array.isArray(array)) {
6
9
  return [];
@@ -16,4 +19,5 @@ function shuffle(array) {
16
19
  }
17
20
  return shuffled;
18
21
  }
22
+
19
23
  exports.shuffle = shuffle;
@@ -1,4 +1,5 @@
1
- import { getRandomInteger } from "../random.js";
1
+ import { getRandomInteger } from '../random.js';
2
+
2
3
  function shuffle(array) {
3
4
  if (!Array.isArray(array)) {
4
5
  return [];
@@ -14,6 +15,5 @@ function shuffle(array) {
14
15
  }
15
16
  return shuffled;
16
17
  }
17
- export {
18
- shuffle
19
- };
18
+
19
+ export { shuffle };
@@ -1,7 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const is = require("../is.cjs");
4
- const value_compare = require("../value/compare.cjs");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const is = require('../is.cjs');
6
+ const value_compare = require('../value/compare.cjs');
7
+
5
8
  function sort(array, first, second) {
6
9
  if (!Array.isArray(array)) {
7
10
  return [];
@@ -23,8 +26,8 @@ function sort(array, first, second) {
23
26
  keyWithCallback.callback = (value) => value[key];
24
27
  } else if (typeof key === "function") {
25
28
  keyWithCallback.callback = key;
26
- } else if (typeof (key == null ? void 0 : key.value) === "function" || is.isKey(key == null ? void 0 : key.value)) {
27
- keyWithCallback.direction = (key == null ? void 0 : key.direction) ?? direction;
29
+ } else if (typeof key?.value === "function" || is.isKey(key?.value)) {
30
+ keyWithCallback.direction = key?.direction ?? direction;
28
31
  keyWithCallback.callback = typeof key.value === "function" ? key.value : (value) => value[key.value];
29
32
  }
30
33
  if (typeof keyWithCallback.callback === "function") {
@@ -60,4 +63,5 @@ function sort(array, first, second) {
60
63
  });
61
64
  return sorted;
62
65
  }
66
+
63
67
  exports.sort = sort;
@@ -1,5 +1,6 @@
1
- import { isKey } from "../is.js";
2
- import { compare } from "../value/compare.js";
1
+ import { isKey } from '../is.js';
2
+ import { compare } from '../value/compare.js';
3
+
3
4
  function sort(array, first, second) {
4
5
  if (!Array.isArray(array)) {
5
6
  return [];
@@ -21,8 +22,8 @@ function sort(array, first, second) {
21
22
  keyWithCallback.callback = (value) => value[key];
22
23
  } else if (typeof key === "function") {
23
24
  keyWithCallback.callback = key;
24
- } else if (typeof (key == null ? void 0 : key.value) === "function" || isKey(key == null ? void 0 : key.value)) {
25
- keyWithCallback.direction = (key == null ? void 0 : key.direction) ?? direction;
25
+ } else if (typeof key?.value === "function" || isKey(key?.value)) {
26
+ keyWithCallback.direction = key?.direction ?? direction;
26
27
  keyWithCallback.callback = typeof key.value === "function" ? key.value : (value) => value[key.value];
27
28
  }
28
29
  if (typeof keyWithCallback.callback === "function") {
@@ -58,6 +59,5 @@ function sort(array, first, second) {
58
59
  });
59
60
  return sorted;
60
61
  }
61
- export {
62
- sort
63
- };
62
+
63
+ export { sort };
@@ -1,6 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const array_insert = require("./insert.cjs");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const array_insert = require('./insert.cjs');
6
+
4
7
  function splice(array, start, deleteCountOrItems, items) {
5
8
  return array_insert.insertValues(
6
9
  "splice",
@@ -10,4 +13,5 @@ function splice(array, start, deleteCountOrItems, items) {
10
13
  typeof deleteCountOrItems === "number" ? deleteCountOrItems : 0
11
14
  );
12
15
  }
16
+
13
17
  exports.splice = splice;
@@ -1,4 +1,5 @@
1
- import { insertValues } from "./insert.js";
1
+ import { insertValues } from './insert.js';
2
+
2
3
  function splice(array, start, deleteCountOrItems, items) {
3
4
  return insertValues(
4
5
  "splice",
@@ -8,6 +9,5 @@ function splice(array, start, deleteCountOrItems, items) {
8
9
  typeof deleteCountOrItems === "number" ? deleteCountOrItems : 0
9
10
  );
10
11
  }
11
- export {
12
- splice
13
- };
12
+
13
+ export { splice };
@@ -1,8 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const internal_array_callbacks = require("../internal/array/callbacks.cjs");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const internal_array_callbacks = require('../internal/array/callbacks.cjs');
6
+
4
7
  function toMap(array, keyOrArrays, valueOrArrays, arrays) {
5
- var _a, _b;
6
8
  if (!Array.isArray(array)) {
7
9
  return /* @__PURE__ */ new Map();
8
10
  }
@@ -12,8 +14,8 @@ function toMap(array, keyOrArrays, valueOrArrays, arrays) {
12
14
  const { length } = array;
13
15
  for (let index = 0; index < length; index += 1) {
14
16
  const item = array[index];
15
- const key = ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, item, index, array)) ?? index;
16
- const value = ((_b = callbacks == null ? void 0 : callbacks.value) == null ? void 0 : _b.call(callbacks, item, index, array)) ?? item;
17
+ const key = callbacks?.key?.(item, index, array) ?? index;
18
+ const value = callbacks?.value?.(item, index, array) ?? item;
17
19
  if (asArrays) {
18
20
  const existing = map.get(key);
19
21
  if (existing == null) {
@@ -27,4 +29,5 @@ function toMap(array, keyOrArrays, valueOrArrays, arrays) {
27
29
  }
28
30
  return map;
29
31
  }
32
+
30
33
  exports.toMap = toMap;