@oscarpalmer/atoms 0.213.0 → 0.214.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 (252) hide show
  1. package/dist/array/difference.d.mts +1 -1
  2. package/dist/array/difference.mjs +3 -2
  3. package/dist/array/exists.d.mts +1 -1
  4. package/dist/array/exists.mjs +3 -2
  5. package/dist/array/filter.d.mts +1 -1
  6. package/dist/array/filter.mjs +1 -0
  7. package/dist/array/find.d.mts +1 -1
  8. package/dist/array/find.mjs +4 -3
  9. package/dist/array/first.d.mts +1 -1
  10. package/dist/array/flatten.d.mts +1 -1
  11. package/dist/array/group-by.d.mts +1 -1
  12. package/dist/array/index.d.mts +2 -2
  13. package/dist/array/insert.mjs +3 -2
  14. package/dist/array/intersection.mjs +3 -2
  15. package/dist/array/last.d.mts +1 -1
  16. package/dist/array/move.d.mts +1 -1
  17. package/dist/array/partition.d.mts +1 -1
  18. package/dist/array/partition.mjs +1 -0
  19. package/dist/array/push.mjs +3 -2
  20. package/dist/array/select.d.mts +10 -12
  21. package/dist/array/select.mjs +1 -0
  22. package/dist/array/single.d.mts +1 -1
  23. package/dist/array/single.mjs +1 -0
  24. package/dist/array/slice.d.mts +1 -1
  25. package/dist/array/slice.mjs +4 -5
  26. package/dist/array/sort.d.mts +4 -103
  27. package/dist/array/sort.mjs +6 -14
  28. package/dist/array/splice.mjs +3 -2
  29. package/dist/array/swap.d.mts +1 -1
  30. package/dist/array/to-map.d.mts +1 -1
  31. package/dist/array/to-record.d.mts +1 -1
  32. package/dist/array/to-set.d.mts +1 -1
  33. package/dist/array/toggle.d.mts +1 -1
  34. package/dist/array/union.mjs +3 -2
  35. package/dist/array/unique.d.mts +1 -1
  36. package/dist/array/unique.mjs +3 -2
  37. package/dist/array/update.d.mts +1 -1
  38. package/dist/beacon.d.mts +6 -92
  39. package/dist/beacon.mjs +6 -16
  40. package/dist/color/constants.d.mts +2 -2
  41. package/dist/color/constants.mjs +1 -1
  42. package/dist/color/index.d.mts +1 -1
  43. package/dist/color/instance.d.mts +1 -1
  44. package/dist/color/misc/alpha.d.mts +1 -1
  45. package/dist/color/misc/format.d.mts +1 -1
  46. package/dist/color/misc/get.d.mts +1 -1
  47. package/dist/color/misc/is.d.mts +2 -2
  48. package/dist/color/misc/is.mjs +1 -0
  49. package/dist/color/misc/state.d.mts +1 -1
  50. package/dist/color/space/hex.d.mts +1 -1
  51. package/dist/color/space/hsl.d.mts +1 -1
  52. package/dist/color/space/hwb.d.mts +1 -1
  53. package/dist/color/space/rgb.d.mts +1 -1
  54. package/dist/function/limit.d.mts +2 -2
  55. package/dist/function/limit.mjs +2 -1
  56. package/dist/function/once.d.mts +7 -3
  57. package/dist/function/once.mjs +5 -10
  58. package/dist/function/retry.d.mts +4 -14
  59. package/dist/function/retry.mjs +3 -15
  60. package/dist/herald.d.mts +2 -2
  61. package/dist/index.d.mts +425 -318
  62. package/dist/index.mjs +454 -408
  63. package/dist/internal/aborter.d.mts +1 -6
  64. package/dist/internal/aborter.mjs +3 -4
  65. package/dist/internal/array/callbacks.d.mts +3 -7
  66. package/dist/internal/array/chunk.mjs +2 -2
  67. package/dist/internal/array/find.d.mts +5 -23
  68. package/dist/internal/array/find.mjs +5 -9
  69. package/dist/internal/array/get.d.mts +1 -1
  70. package/dist/internal/array/group.d.mts +1 -1
  71. package/dist/internal/array/index-of.d.mts +1 -1
  72. package/dist/internal/array/index-of.mjs +4 -3
  73. package/dist/internal/array/insert.d.mts +2 -5
  74. package/dist/internal/array/insert.mjs +2 -4
  75. package/dist/internal/array/match.d.mts +2 -5
  76. package/dist/internal/array/match.mjs +10 -20
  77. package/dist/internal/array/overlap.d.mts +2 -10
  78. package/dist/internal/array/sets.d.mts +2 -5
  79. package/dist/internal/array/sets.mjs +5 -7
  80. package/dist/internal/function/assert.d.mts +5 -12
  81. package/dist/internal/function/assert.mjs +2 -2
  82. package/dist/internal/function/limit.d.mts +2 -37
  83. package/dist/internal/function/limit.mjs +4 -15
  84. package/dist/internal/function/memoize.d.mts +5 -70
  85. package/dist/internal/function/memoize.mjs +2 -5
  86. package/dist/internal/function/work.d.mts +16 -22
  87. package/dist/internal/function/work.mjs +1 -8
  88. package/dist/internal/herald.d.mts +3 -3
  89. package/dist/internal/herald.mjs +2 -1
  90. package/dist/internal/is.d.mts +1 -1
  91. package/dist/internal/math/aggregate.d.mts +2 -14
  92. package/dist/internal/math/aggregate.mjs +2 -5
  93. package/dist/internal/number.mjs +4 -7
  94. package/dist/internal/result/attempt.d.mts +1 -1
  95. package/dist/internal/result/misc.d.mts +1 -1
  96. package/dist/internal/string/case.mjs +6 -16
  97. package/dist/internal/string/misc.mjs +1 -2
  98. package/dist/internal/subscription.d.mts +1 -100
  99. package/dist/internal/subscription.mjs +3 -9
  100. package/dist/internal/value/compare.d.mts +4 -4
  101. package/dist/internal/value/compare.mjs +1 -1
  102. package/dist/internal/value/equal.d.mts +6 -57
  103. package/dist/internal/value/equal.mjs +5 -10
  104. package/dist/internal/value/get.d.mts +1 -1
  105. package/dist/internal/value/handlers.d.mts +2 -21
  106. package/dist/internal/value/has.d.mts +2 -2
  107. package/dist/internal/value/misc.d.mts +1 -1
  108. package/dist/internal/value/misc.mjs +8 -14
  109. package/dist/internal/value/set.d.mts +1 -1
  110. package/dist/internal/value/set.mjs +2 -2
  111. package/dist/is.mjs +3 -3
  112. package/dist/logger.d.mts +3 -70
  113. package/dist/logger.mjs +2 -5
  114. package/dist/math.d.mts +1 -1
  115. package/dist/math.mjs +2 -1
  116. package/dist/models/aborter.model.d.mts +12 -0
  117. package/dist/models/aborter.model.mjs +5 -0
  118. package/dist/models/array/array.find.model.d.mts +22 -0
  119. package/dist/models/array/array.find.model.mjs +8 -0
  120. package/dist/models/array/array.match.model.d.mts +14 -0
  121. package/dist/models/array/array.match.model.mjs +14 -0
  122. package/dist/models/array/array.misc.model.d.mts +36 -0
  123. package/dist/models/array/array.misc.model.mjs +12 -0
  124. package/dist/models/array/array.sort.model.d.mts +122 -0
  125. package/dist/models/array/array.sort.model.mjs +12 -0
  126. package/dist/models/beacon.model.d.mts +119 -0
  127. package/dist/models/beacon.model.mjs +16 -0
  128. package/dist/{color/models.d.mts → models/color.model.d.mts} +4 -4
  129. package/dist/models/function/assert.model.d.mts +13 -0
  130. package/dist/models/function/assert.model.mjs +4 -0
  131. package/dist/models/function/limiter.model.d.mts +71 -0
  132. package/dist/models/function/limiter.model.mjs +15 -0
  133. package/dist/models/function/memoize.model.d.mts +88 -0
  134. package/dist/models/function/memoize.model.mjs +7 -0
  135. package/dist/models/function/once.model.d.mts +76 -0
  136. package/dist/models/function/once.model.mjs +9 -0
  137. package/dist/models/function/retry.model.d.mts +17 -0
  138. package/dist/models/function/retry.model.mjs +17 -0
  139. package/dist/models/function/work.model.d.mts +20 -0
  140. package/dist/models/function/work.model.mjs +11 -0
  141. package/dist/{internal/models → models}/herald.model.d.mts +3 -3
  142. package/dist/{internal/models → models}/herald.model.mjs +2 -2
  143. package/dist/{models.d.mts → models/index.d.mts} +5 -47
  144. package/dist/models/logger.model.d.mts +83 -0
  145. package/dist/models/logger.model.mjs +7 -0
  146. package/dist/models/math.model.d.mts +16 -0
  147. package/dist/models/math.model.mjs +7 -0
  148. package/dist/models/misc.model.d.mts +10 -0
  149. package/dist/models/misc.model.mjs +11 -0
  150. package/dist/{internal/models → models}/plan.model.d.mts +3 -3
  151. package/dist/{internal/models → models}/plan.model.mjs +1 -1
  152. package/dist/models/promise.model.d.mts +119 -0
  153. package/dist/models/promise.model.mjs +47 -0
  154. package/dist/models/query.model.d.mts +9 -0
  155. package/dist/models/query.model.mjs +14 -0
  156. package/dist/models/queue.model.d.mts +251 -0
  157. package/dist/models/queue.model.mjs +29 -0
  158. package/dist/models/random.model.d.mts +6 -0
  159. package/dist/models/random.model.mjs +7 -0
  160. package/dist/{internal/models → models}/result.model.d.mts +10 -2
  161. package/dist/models/string/string.case.model.d.mts +19 -0
  162. package/dist/models/string/string.case.model.mjs +14 -0
  163. package/dist/models/string/string.fuzzy.model.d.mts +108 -0
  164. package/dist/models/string/string.fuzzy.model.mjs +9 -0
  165. package/dist/models/string/string.misc.model.d.mts +13 -0
  166. package/dist/models/string/string.misc.model.mjs +13 -0
  167. package/dist/models/string/string.normalize.model.d.mts +85 -0
  168. package/dist/models/string/string.normalize.model.mjs +43 -0
  169. package/dist/models/string/string.template.model.d.mts +50 -0
  170. package/dist/models/string/string.template.model.mjs +5 -0
  171. package/dist/models/subscription.model.d.mts +127 -0
  172. package/dist/models/subscription.model.mjs +10 -0
  173. package/dist/models/value/value.clone.model.d.mts +56 -0
  174. package/dist/models/value/value.clone.model.mjs +24 -0
  175. package/dist/models/value/value.diff.model.d.mts +61 -0
  176. package/dist/models/value/value.diff.model.mjs +6 -0
  177. package/dist/models/value/value.equal.model.d.mts +76 -0
  178. package/dist/models/value/value.equal.model.mjs +9 -0
  179. package/dist/models/value/value.handler.model.d.mts +27 -0
  180. package/dist/models/value/value.handler.model.mjs +1 -0
  181. package/dist/models/value/value.merge.model.d.mts +82 -0
  182. package/dist/models/value/value.merge.model.mjs +5 -0
  183. package/dist/models/value/value.misc.model.d.mts +33 -0
  184. package/dist/models/value/value.misc.model.mjs +12 -0
  185. package/dist/models/value/value.transform.model.d.mts +28 -0
  186. package/dist/models/value/value.transform.model.mjs +4 -0
  187. package/dist/plan/generate.d.mts +3 -2
  188. package/dist/plan/generate.mjs +11 -7
  189. package/dist/plan/index.d.mts +1 -1
  190. package/dist/plan/index.mjs +1 -1
  191. package/dist/plan/is.d.mts +1 -1
  192. package/dist/plan/is.mjs +1 -1
  193. package/dist/plan/misc.d.mts +1 -1
  194. package/dist/plan/models.d.mts +1 -1
  195. package/dist/plan/result.d.mts +2 -2
  196. package/dist/plan/result.mjs +3 -3
  197. package/dist/plan/run.d.mts +1 -1
  198. package/dist/plan/run.mjs +3 -3
  199. package/dist/promise/delay.d.mts +1 -1
  200. package/dist/promise/delay.mjs +2 -1
  201. package/dist/promise/helpers.d.mts +2 -2
  202. package/dist/promise/helpers.mjs +6 -6
  203. package/dist/promise/index.d.mts +2 -2
  204. package/dist/promise/index.mjs +1 -1
  205. package/dist/promise/misc.d.mts +3 -3
  206. package/dist/promise/misc.mjs +7 -4
  207. package/dist/promise/models.d.mts +2 -106
  208. package/dist/promise/models.mjs +1 -35
  209. package/dist/promise/timed.d.mts +2 -2
  210. package/dist/promise/timed.mjs +3 -3
  211. package/dist/query.d.mts +1 -1
  212. package/dist/query.mjs +5 -15
  213. package/dist/queue.d.mts +6 -200
  214. package/dist/queue.mjs +9 -34
  215. package/dist/random.mjs +2 -5
  216. package/dist/result/match.d.mts +1 -1
  217. package/dist/result/match.mjs +27 -15
  218. package/dist/result/misc.d.mts +1 -1
  219. package/dist/result/work/flow.d.mts +13 -21
  220. package/dist/result/work/pipe.d.mts +2 -2
  221. package/dist/string/fuzzy.d.mts +5 -87
  222. package/dist/string/fuzzy.mjs +6 -11
  223. package/dist/string/index.mjs +6 -8
  224. package/dist/string/match.mjs +4 -6
  225. package/dist/string/normalize.d.mts +4 -40
  226. package/dist/string/normalize.mjs +9 -48
  227. package/dist/string/template.d.mts +5 -43
  228. package/dist/string/template.mjs +1 -2
  229. package/dist/subscription.d.mts +2 -1
  230. package/dist/value/clone.d.mts +6 -42
  231. package/dist/value/clone.mjs +10 -30
  232. package/dist/value/collection.mjs +2 -0
  233. package/dist/value/diff.d.mts +3 -44
  234. package/dist/value/diff.mjs +1 -3
  235. package/dist/value/freeze.d.mts +1 -5
  236. package/dist/value/index.d.mts +4 -3
  237. package/dist/value/merge.d.mts +6 -64
  238. package/dist/value/merge.mjs +8 -8
  239. package/dist/value/omit.d.mts +1 -1
  240. package/dist/value/pick.d.mts +1 -1
  241. package/dist/value/shake.d.mts +4 -6
  242. package/dist/value/smush.d.mts +4 -6
  243. package/dist/value/smush.mjs +2 -2
  244. package/dist/value/transform.d.mts +6 -22
  245. package/dist/value/transform.mjs +1 -1
  246. package/dist/value/unsmush.d.mts +4 -10
  247. package/package.json +12 -4
  248. package/dist/promise/constants.d.mts +0 -17
  249. package/dist/promise/constants.mjs +0 -15
  250. /package/dist/{color/models.mjs → models/color.model.mjs} +0 -0
  251. /package/dist/{internal/models/result.model.mjs → models/index.mjs} +0 -0
  252. /package/dist/{models.mjs → models/result.model.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/difference.d.ts
3
3
  /**
4
4
  * Get the items from the first array that are not in the second array
@@ -1,7 +1,8 @@
1
- import { SETS_COMPARE_DIFFERENCE, compareSets } from "../internal/array/sets.mjs";
1
+ import { ARRAY_SETS_COMPARE_DIFFERENCE } from "../models/array/array.misc.model.mjs";
2
+ import { compareSets } from "../internal/array/sets.mjs";
2
3
  //#region src/array/difference.ts
3
4
  function difference(first, second, key) {
4
- return compareSets(SETS_COMPARE_DIFFERENCE, first, second, key);
5
+ return compareSets(ARRAY_SETS_COMPARE_DIFFERENCE, first, second, key);
5
6
  }
6
7
  //#endregion
7
8
  export { difference };
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/exists.d.ts
3
3
  /**
4
4
  * Does an item with a specific value exist in the array?
@@ -1,8 +1,9 @@
1
- import { FIND_VALUE_INDEX, findValue } from "../internal/array/find.mjs";
1
+ import { ARRAY_FIND_VALUE_INDEX } from "../models/array/array.find.model.mjs";
2
+ import { findValue } from "../internal/array/find.mjs";
2
3
  //#region src/array/exists.ts
3
4
  function exists(array, ...parameters) {
4
5
  if (parameters.length === 1 && typeof parameters[0] !== "function") return Array.isArray(array) ? array.includes(parameters[0]) : false;
5
- return findValue(FIND_VALUE_INDEX, array, parameters, false) > -1;
6
+ return findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, false) > -1;
6
7
  }
7
8
  //#endregion
8
9
  export { exists };
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/filter.d.ts
3
3
  /**
4
4
  * Get a filtered array of items that do not match the value
@@ -1,3 +1,4 @@
1
+ import "../models/array/array.find.model.mjs";
1
2
  import { findValues } from "../internal/array/find.mjs";
2
3
  //#region src/array/filter.ts
3
4
  function exclude(array, ...parameters) {
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/find.d.ts
3
3
  /**
4
4
  * Get the first item matching the given value
@@ -1,10 +1,11 @@
1
- import { FIND_VALUE_ITEM, findValue } from "../internal/array/find.mjs";
1
+ import { ARRAY_FIND_VALUE_ITEM } from "../models/array/array.find.model.mjs";
2
+ import { findValue } from "../internal/array/find.mjs";
2
3
  //#region src/array/find.ts
3
4
  function find(array, ...parameters) {
4
- return findValue(FIND_VALUE_ITEM, array, parameters, false);
5
+ return findValue(ARRAY_FIND_VALUE_ITEM, array, parameters, false);
5
6
  }
6
7
  function findLast(array, ...parameters) {
7
- return findValue(FIND_VALUE_ITEM, array, parameters, true);
8
+ return findValue(ARRAY_FIND_VALUE_ITEM, array, parameters, true);
8
9
  }
9
10
  find.last = findLast;
10
11
  //#endregion
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/first.d.ts
3
3
  /**
4
4
  * Get the first item matching the given value
@@ -1,4 +1,4 @@
1
- import { NestedArray } from "../models.mjs";
1
+ import { NestedArray } from "../models/index.mjs";
2
2
  //#region src/array/flatten.d.ts
3
3
  /**
4
4
  * Flatten an array _(using native `flat` and maximum depth)_
@@ -1,4 +1,4 @@
1
- import { Key, KeyOrCallback, KeyOrCallbackKey, KeyOrCallbackValue, Simplify } from "../models.mjs";
1
+ import { Key, KeyOrCallback, KeyOrCallbackKey, KeyOrCallbackValue, Simplify } from "../models/index.mjs";
2
2
  //#region src/array/group-by.d.ts
3
3
  /**
4
4
  * Create a record from an array of items using a specific key
@@ -5,7 +5,7 @@ import { range, times } from "./from.mjs";
5
5
  import { chunk } from "../internal/array/chunk.mjs";
6
6
  import { compact } from "../internal/array/compact.mjs";
7
7
  import { getArray } from "../internal/array/get.mjs";
8
- import { ArrayComparison, endsWithArray, getArrayComparison, includesArray, indexOfArray, startsWithArray } from "../internal/array/match.mjs";
8
+ import { endsWithArray, getArrayComparison, includesArray, indexOfArray, startsWithArray } from "../internal/array/match.mjs";
9
9
  import { shuffle } from "../internal/array/shuffle.mjs";
10
10
  import { insert } from "./insert.mjs";
11
11
  import { intersection } from "./intersection.mjs";
@@ -20,4 +20,4 @@ import { toggle } from "./toggle.mjs";
20
20
  import { union } from "./union.mjs";
21
21
  import { unique } from "./unique.mjs";
22
22
  import { update } from "./update.mjs";
23
- export { ArrayComparison, push as append, push, chunk, compact, difference, drop, endsWithArray, exists, flatten, getArray, getArrayComparison, includesArray, indexOfArray, insert, intersection, partition, range, reverse, shuffle, single, slice, splice, startsWithArray, take, times, toSet, toggle, union, unique, update };
23
+ export { push as append, push, chunk, compact, difference, drop, endsWithArray, exists, flatten, getArray, getArrayComparison, includesArray, indexOfArray, insert, intersection, partition, range, reverse, shuffle, single, slice, splice, startsWithArray, take, times, toSet, toggle, union, unique, update };
@@ -1,7 +1,8 @@
1
- import { INSERT_TYPE_INSERT, insertValues } from "../internal/array/insert.mjs";
1
+ import { ARRAY_INSERT_TYPE_INSERT } from "../models/array/array.misc.model.mjs";
2
+ import { insertValues } from "../internal/array/insert.mjs";
2
3
  //#region src/array/insert.ts
3
4
  function insert(array, indexOrItems, items) {
4
- return insertValues(INSERT_TYPE_INSERT, array, items == null ? indexOrItems : items, typeof indexOrItems === "number" ? indexOrItems : array?.length, 0);
5
+ return insertValues(ARRAY_INSERT_TYPE_INSERT, array, items == null ? indexOrItems : items, typeof indexOrItems === "number" ? indexOrItems : array?.length, 0);
5
6
  }
6
7
  //#endregion
7
8
  export { insert };
@@ -1,7 +1,8 @@
1
- import { SETS_COMPARE_INTERSECTION, compareSets } from "../internal/array/sets.mjs";
1
+ import { ARRAY_SETS_COMPARE_INTERSECTION } from "../models/array/array.misc.model.mjs";
2
+ import { compareSets } from "../internal/array/sets.mjs";
2
3
  //#region src/array/intersection.ts
3
4
  function intersection(first, second, key) {
4
- return compareSets(SETS_COMPARE_INTERSECTION, first, second, key);
5
+ return compareSets(ARRAY_SETS_COMPARE_INTERSECTION, first, second, key);
5
6
  }
6
7
  //#endregion
7
8
  export { intersection };
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/last.d.ts
3
3
  /**
4
4
  * Get the last items matching the given value
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/move.d.ts
3
3
  /**
4
4
  * Move an item _(or array of items)_ to the position of another item _(or array of items)_ within an array
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/partition.d.ts
3
3
  /**
4
4
  * Get a partitioned array of items
@@ -1,3 +1,4 @@
1
+ import "../models/array/array.find.model.mjs";
1
2
  import { findValues } from "../internal/array/find.mjs";
2
3
  //#region src/array/partition.ts
3
4
  function partition(array, ...parameters) {
@@ -1,4 +1,5 @@
1
- import { INSERT_TYPE_PUSH, insertValues } from "../internal/array/insert.mjs";
1
+ import { ARRAY_INSERT_TYPE_PUSH } from "../models/array/array.misc.model.mjs";
2
+ import { insertValues } from "../internal/array/insert.mjs";
2
3
  //#region src/array/push.ts
3
4
  /**
4
5
  * Push items into an array _(at the end)_
@@ -15,7 +16,7 @@ import { INSERT_TYPE_PUSH, insertValues } from "../internal/array/insert.mjs";
15
16
  * ```
16
17
  */
17
18
  function push(array, pushed) {
18
- return insertValues(INSERT_TYPE_PUSH, array, pushed, array.length, 0);
19
+ return insertValues(ARRAY_INSERT_TYPE_PUSH, array, pushed, array.length, 0);
19
20
  }
20
21
  //#endregion
21
22
  export { push as append, push };
@@ -1,8 +1,6 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
+ import { ArrayMapKeyOrCallback, ArrayMapped, ArrayObjectKeysOf } from "../models/array/array.misc.model.mjs";
2
3
  //#region src/array/select.d.ts
3
- type MapKeyOrCallback<Item> = ((item: Item, index: number, array: Item[]) => unknown) | (Item extends PlainObject ? keyof Item : never);
4
- type Mapped<Item, Map extends MapKeyOrCallback<Item>> = Map extends ((item: Item, index: number, array: Item[]) => unknown) ? ReturnType<Map> : Map extends keyof Item ? Item[Map] : never;
5
- type ObjectKeysOf<Item> = { [Key in keyof Item]: Item[Key] extends PlainObject ? Key : never; }[keyof Item];
6
4
  /**
7
5
  * Get a filtered and mapped array of items
8
6
  *
@@ -22,7 +20,7 @@ type ObjectKeysOf<Item> = { [Key in keyof Item]: Item[Key] extends PlainObject ?
22
20
  * ); // => ['Bob']
23
21
  * ```
24
22
  */
25
- export declare function filterAndMap<Item, FilterCallback extends (item: Item, index: number, array: Item[]) => unknown, Map extends MapKeyOrCallback<Item>>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>, map: Map): Array<Mapped<Item, Map>>;
23
+ export declare function filterAndMap<Item, FilterCallback extends (item: Item, index: number, array: Item[]) => unknown, Map extends ArrayMapKeyOrCallback<Item>>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>, map: Map): Array<ArrayMapped<Item, Map>>;
26
24
  /**
27
25
  * Get a filtered and mapped array of items
28
26
  *
@@ -42,7 +40,7 @@ export declare function filterAndMap<Item, FilterCallback extends (item: Item, i
42
40
  * ); // => ['Bob']
43
41
  * ```
44
42
  */
45
- export declare function filterAndMap<Item extends PlainObject, ItemKey extends keyof Item, Map extends MapKeyOrCallback<Item>>(array: Item[], filterKey: ItemKey, filterValue: Item[ItemKey], map: Map): Array<Mapped<Item, Map>>;
43
+ export declare function filterAndMap<Item extends PlainObject, ItemKey extends keyof Item, Map extends ArrayMapKeyOrCallback<Item>>(array: Item[], filterKey: ItemKey, filterValue: Item[ItemKey], map: Map): Array<ArrayMapped<Item, Map>>;
46
44
  /**
47
45
  * Get a filtered and mapped array of items
48
46
  *
@@ -60,7 +58,7 @@ export declare function filterAndMap<Item extends PlainObject, ItemKey extends k
60
58
  * ); // => ['Bob']
61
59
  * ```
62
60
  */
63
- export declare function filterAndMap<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean, map: Map): Array<Mapped<Item, Map>>;
61
+ export declare function filterAndMap<Item, Map extends ArrayMapKeyOrCallback<Item>>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean, map: Map): Array<ArrayMapped<Item, Map>>;
64
62
  /**
65
63
  * Get a filtered and mapped array of items
66
64
  *
@@ -78,7 +76,7 @@ export declare function filterAndMap<Item, Map extends MapKeyOrCallback<Item>>(a
78
76
  * ); // => [9]
79
77
  * ```
80
78
  */
81
- export declare function filterAndMap<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], item: Item, map: Map): Array<Mapped<Item, Map>>;
79
+ export declare function filterAndMap<Item, Map extends ArrayMapKeyOrCallback<Item>>(array: Item[], item: Item, map: Map): Array<ArrayMapped<Item, Map>>;
82
80
  /**
83
81
  * Get a mapped and filtered array of items
84
82
  *
@@ -100,7 +98,7 @@ export declare function filterAndMap<Item, Map extends MapKeyOrCallback<Item>>(a
100
98
  * ); // => ['Bob']
101
99
  * ```
102
100
  */
103
- export declare function mapAndFilter<Item, Map extends MapKeyOrCallback<Item>, FilterCallback extends (item: Mapped<Item, Map>, index: number, array: Item[]) => unknown>(array: Item[], map: Map, filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>): Array<Mapped<Item, Map>>;
101
+ export declare function mapAndFilter<Item, Map extends ArrayMapKeyOrCallback<Item>, FilterCallback extends (item: ArrayMapped<Item, Map>, index: number, array: Item[]) => unknown>(array: Item[], map: Map, filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>): Array<ArrayMapped<Item, Map>>;
104
102
  /**
105
103
  * Get a mapped and filtered array of items
106
104
  *
@@ -144,7 +142,7 @@ export declare function mapAndFilter<Item, MapCallback extends (item: Item, inde
144
142
  * ); // => [{tag: 'b'}]
145
143
  * ```
146
144
  */
147
- export declare function mapAndFilter<Item, MapKey extends ObjectKeysOf<Item>, ItemKey extends keyof Item[MapKey]>(array: Item[], map: MapKey, filterKey: ItemKey, filterValue: Item[MapKey][ItemKey]): Array<Item[MapKey]>;
145
+ export declare function mapAndFilter<Item, MapKey extends ArrayObjectKeysOf<Item>, ItemKey extends keyof Item[MapKey]>(array: Item[], map: MapKey, filterKey: ItemKey, filterValue: Item[MapKey][ItemKey]): Array<Item[MapKey]>;
148
146
  /**
149
147
  * Get a mapped and filtered array of items
150
148
  *
@@ -164,7 +162,7 @@ export declare function mapAndFilter<Item, MapKey extends ObjectKeysOf<Item>, It
164
162
  * ); // => ['Bob']
165
163
  * ```
166
164
  */
167
- export declare function mapAndFilter<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], map: Map, filter: (item: Mapped<Item, Map>, index: number, array: Item[]) => boolean): Array<Mapped<Item, Map>>;
165
+ export declare function mapAndFilter<Item, Map extends ArrayMapKeyOrCallback<Item>>(array: Item[], map: Map, filter: (item: ArrayMapped<Item, Map>, index: number, array: Item[]) => boolean): Array<ArrayMapped<Item, Map>>;
168
166
  /**
169
167
  * Get a mapped and filtered array of items
170
168
  *
@@ -184,7 +182,7 @@ export declare function mapAndFilter<Item, Map extends MapKeyOrCallback<Item>>(a
184
182
  * ); // => [4, 4]
185
183
  * ```
186
184
  */
187
- export declare function mapAndFilter<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], map: Map, value: Mapped<Item, Map>): Array<Mapped<Item, Map>>;
185
+ export declare function mapAndFilter<Item, Map extends ArrayMapKeyOrCallback<Item>>(array: Item[], map: Map, value: ArrayMapped<Item, Map>): Array<ArrayMapped<Item, Map>>;
188
186
  export declare namespace filterAndMap {
189
187
  export var reverse: typeof mapAndFilter;
190
188
  }
@@ -1,3 +1,4 @@
1
+ import "../models/array/array.find.model.mjs";
1
2
  import { findValues } from "../internal/array/find.mjs";
2
3
  //#region src/array/select.ts
3
4
  function filterAndMap(array, ...parameters) {
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/single.d.ts
3
3
  /**
4
4
  * Get the _only_ item matching the given value
@@ -1,3 +1,4 @@
1
+ import "../models/array/array.find.model.mjs";
1
2
  import { findValues } from "../internal/array/find.mjs";
2
3
  //#region src/array/single.ts
3
4
  function single(array, ...parameters) {
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/slice.d.ts
3
3
  /**
4
4
  * Drop items from the start of an array until they match a value
@@ -1,13 +1,14 @@
1
1
  import { getArrayCallbacks } from "../internal/array/callbacks.mjs";
2
+ import { ARRAY_SLICE_DROP, ARRAY_SLICE_TAKE } from "../models/array/array.misc.model.mjs";
2
3
  //#region src/array/slice.ts
3
4
  function drop(array, first, second) {
4
- return extract(SLICE_DROP, array, first, second);
5
+ return extract(ARRAY_SLICE_DROP, array, first, second);
5
6
  }
6
7
  function extract(type, array, first, second) {
7
8
  if (!Array.isArray(array)) return [];
8
9
  const { length } = array;
9
10
  if (length === 0) return [];
10
- const isTake = type === SLICE_TAKE;
11
+ const isTake = type === ARRAY_SLICE_TAKE;
11
12
  if (typeof first === "number") {
12
13
  if (Math.abs(first) >= length) return isTake ? array.slice() : [];
13
14
  if (first === 0) return isTake ? [] : array.slice();
@@ -45,9 +46,7 @@ function slice(array, first, second) {
45
46
  return first >= 0 ? array.slice(first, second) : array.slice(array.length + first, array.length + second);
46
47
  }
47
48
  function take(array, first, second) {
48
- return extract(SLICE_TAKE, array, first, second);
49
+ return extract(ARRAY_SLICE_TAKE, array, first, second);
49
50
  }
50
- const SLICE_DROP = "drop";
51
- const SLICE_TAKE = "take";
52
51
  //#endregion
53
52
  export { drop, slice, take };
@@ -1,104 +1,6 @@
1
- import { PlainObject, Primitive } from "../models.mjs";
1
+ import { ArrayComparisonSorter, ArrayKeySorter, ArrayKeySorters, ArraySorter, ArraySorters, ArrayValueSorter, CompareCallback, ComparisonSorter, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, SortDirection, SortHandler, Sorter } from "../models/array/array.sort.model.mjs";
2
2
  //#region src/array/sort.d.ts
3
- /**
4
- * Sorting information for arrays _(using a comparison callback)_
5
- */
6
- export type ArrayComparisonSorter<Item> = {
7
- /**
8
- * Callback to use when comparing items and values
9
- */
10
- comparison: ComparisonSorter<Item>;
11
- /**
12
- * Direction to sort by
13
- */
14
- direction?: SortDirection;
15
- };
16
- /**
17
- * Sorting information for arrays _(using a key)_
18
- */
19
- export type ArrayKeySorter<Item extends PlainObject, ItemKey extends keyof Item> = {
20
- /**
21
- * Comparator to use when comparing items and values
22
- */
23
- compare?: CompareCallback<Item, Item[ItemKey]>;
24
- /**
25
- * Direction to sort by
26
- */
27
- direction?: SortDirection;
28
- /**
29
- * Key to sort by
30
- */
31
- key: ItemKey;
32
- };
33
- /**
34
- * Sorters based on keys in an object
35
- */
36
- type ArrayKeySorters<Item extends PlainObject> = { [ItemKey in keyof Item]: ArrayKeySorter<Item, ItemKey>; }[keyof Item];
37
- /**
38
- * Sorter to use for sorting
39
- */
40
- export type ArraySorter<Item> = Item extends PlainObject ? keyof Item | ArrayComparisonSorter<Item> | ArrayKeySorters<Item> | ArrayValueSorter<Item> | ComparisonSorter<Item> : ArrayComparisonSorter<Item> | ArrayValueSorter<Item> | ComparisonSorter<Item>;
41
- /**
42
- * Sorters to use for sorting
43
- */
44
- export type ArraySorters<Item> = Array<ArraySorter<Item>>;
45
- /**
46
- * Sorting information for arrays _(using a value callback and built-in comparison)_
47
- */
48
- export type ArrayValueSorter<Item> = {
49
- /**
50
- * Direction to sort by
51
- */
52
- direction?: SortDirection;
53
- /**
54
- * Value to sort by
55
- */
56
- value(item: Item): unknown;
57
- };
58
- /**
59
- * Comparator to use when comparing items and values
60
- */
61
- type CompareCallback<Item, Value = CompareCallbackValue<Item>> = (first: Item, firstValue: Value, second: Item, secondValue: Value) => number;
62
- type CompareCallbackValue<Item> = Item extends Primitive ? Item : unknown;
63
- /**
64
- * Callback to use when comparing items and values
65
- */
66
- type ComparisonSorter<Item> = (first: Item, second: Item) => number;
67
- /**
68
- * Direction to sort by
69
- */
70
- export type SortDirection = "ascending" | "descending";
71
- /**
72
- * Sorter for an array with predefined sorters
73
- *
74
- * Can be used to sort an array, get the predicted index for an item, and check if an array is sorted
75
- */
76
- export type Sorter<Item> = {
77
- /**
78
- * Get the index for an item _(to be inserted into an array of items)_
79
- *
80
- * _(If the array is not sorted, it will be treated as sorted, and the result may be inaccurate)_
81
- *
82
- * @param array Array to get the index from
83
- * @param item Item to get the index for
84
- * @returns Index for item
85
- */
86
- index(array: Item[], item: Item): number;
87
- /**
88
- * Is the array sorted?
89
- *
90
- * @param array Array to check
91
- * @returns `true` if sorted, otherwise `false`
92
- */
93
- is(array: Item[]): boolean;
94
- /**
95
- * Sort an array of items
96
- *
97
- * @param array Array to sort
98
- * @returns Sorted array
99
- */
100
- sort(array: Item[]): Item[];
101
- };
3
+ declare function Sorter(this: any, sorters: SortHandler[]): void;
102
4
  /**
103
5
  * Get the index for an item _(to be inserted into an array of items)_ based on sorters _(and an optional default direction)_
104
6
  *
@@ -244,11 +146,10 @@ export declare function sort<Item>(array: Item[], sorter: ArraySorter<Item>, des
244
146
  * @returns Sorted array
245
147
  */
246
148
  export declare function sort<Item>(array: Item[], descending?: boolean): Item[];
247
- export declare const SORT_DIRECTION_ASCENDING: SortDirection;
248
- export declare const SORT_DIRECTION_DESCENDING: SortDirection;
249
149
  export declare namespace sort {
250
150
  export var getIndex: typeof getSortedIndex;
251
151
  export var initialize: typeof initializeSorter;
252
152
  export var is: typeof isSorted;
253
153
  }
254
- //#endregion
154
+ //#endregion
155
+ export { type ArrayComparisonSorter, type ArrayKeySorter, type ArrayKeySorters, type ArraySorter, type ArraySorters, type ArrayValueSorter, type CompareCallback, type ComparisonSorter, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, type SortDirection, type Sorter };
@@ -1,6 +1,7 @@
1
1
  import { isPlainObject } from "../internal/is.mjs";
2
2
  import { floor, round } from "../internal/math/misc.mjs";
3
3
  import { compare } from "../internal/value/compare.mjs";
4
+ import { SORTER_SYMBOL, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, arrayModifiers } from "../models/array/array.sort.model.mjs";
4
5
  //#region src/array/sort.ts
5
6
  function Sorter(sorters) {
6
7
  this[SORTER_SYMBOL] = sorters;
@@ -26,7 +27,7 @@ function getComparisonValue(first, second, sorters, length) {
26
27
  return 0;
27
28
  }
28
29
  function getModifier(first, second) {
29
- return modifiers[first === true || second === true ? SORT_DIRECTION_DESCENDING : SORT_DIRECTION_ASCENDING];
30
+ return arrayModifiers[first === true || second === true ? SORT_DIRECTION_DESCENDING : SORT_DIRECTION_ASCENDING];
30
31
  }
31
32
  function getObjectSorter(obj, modifier) {
32
33
  let sorter;
@@ -35,7 +36,7 @@ function getObjectSorter(obj, modifier) {
35
36
  sorter = getValueSortHandlers(obj.key, modifier);
36
37
  if (typeof obj.compare === "function") sorter.comparison = { complex: obj.compare };
37
38
  } else if (typeof obj.value === "function") sorter = getValueSortHandlers(obj.value, modifier);
38
- if (sorter != null && typeof obj.direction === "string") sorter.modifier = modifiers[obj.direction] ?? modifier;
39
+ if (sorter != null && typeof obj.direction === "string") sorter.modifier = arrayModifiers[obj.direction] ?? modifier;
39
40
  return sorter;
40
41
  }
41
42
  function getSortedArrayIndex(array, item) {
@@ -103,9 +104,9 @@ function isSortedArray(array) {
103
104
  const sorters = Array.isArray(this) ? this : this[SORTER_SYMBOL];
104
105
  const sortersLength = sorters.length;
105
106
  let offset = 0;
106
- if (length >= SORT_THRESHOLD) {
107
- offset = round(length / SORT_PEEK_PERCENTAGE);
108
- offset = offset > SORT_THRESHOLD ? SORT_THRESHOLD : offset;
107
+ if (length >= 100) {
108
+ offset = round(length / 10);
109
+ offset = offset > 100 ? 100 : offset;
109
110
  for (let index = 0; index < offset; index += 1) {
110
111
  const [firstItem, firstOffset] = [array[index], array[index + 1]];
111
112
  const [secondItem, secondOffset] = [array[length - index - 2], array[length - index - 1]];
@@ -130,15 +131,6 @@ function sortArray(array) {
130
131
  const { length } = sorters;
131
132
  return array.length > 1 ? array.sort((first, second) => getComparisonValue(first, second, sorters, length)) : array;
132
133
  }
133
- const SORT_PEEK_PERCENTAGE = 10;
134
- const SORT_THRESHOLD = 100;
135
- const SORT_DIRECTION_ASCENDING = "ascending";
136
- const SORT_DIRECTION_DESCENDING = "descending";
137
- const SORTER_SYMBOL = Symbol("sorter");
138
- const modifiers = {
139
- [SORT_DIRECTION_ASCENDING]: 1,
140
- [SORT_DIRECTION_DESCENDING]: -1
141
- };
142
134
  sort.getIndex = getSortedIndex;
143
135
  sort.initialize = initializeSorter;
144
136
  sort.is = isSorted;
@@ -1,8 +1,9 @@
1
- import { INSERT_TYPE_SPLICE, insertValues } from "../internal/array/insert.mjs";
1
+ import { ARRAY_INSERT_TYPE_SPLICE } from "../models/array/array.misc.model.mjs";
2
+ import { insertValues } from "../internal/array/insert.mjs";
2
3
  //#region src/array/splice.ts
3
4
  function splice(array, start, deleteCountOrItems, items) {
4
5
  const deleteCountIsNumber = typeof deleteCountOrItems === "number";
5
- return insertValues(INSERT_TYPE_SPLICE, array, deleteCountIsNumber ? items : deleteCountOrItems, start, deleteCountIsNumber ? deleteCountOrItems : 0);
6
+ return insertValues(ARRAY_INSERT_TYPE_SPLICE, array, deleteCountIsNumber ? items : deleteCountOrItems, start, deleteCountIsNumber ? deleteCountOrItems : 0);
6
7
  }
7
8
  //#endregion
8
9
  export { splice };
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/swap.d.ts
3
3
  /**
4
4
  * Swap two smaller arrays within a larger array
@@ -1,4 +1,4 @@
1
- import { Key, KeyOrCallback, KeyOrCallbackKey, KeyOrCallbackValue } from "../models.mjs";
1
+ import { Key, KeyOrCallback, KeyOrCallbackKey, KeyOrCallbackValue } from "../models/index.mjs";
2
2
  //#region src/array/to-map.d.ts
3
3
  /**
4
4
  * Create a _Map_ from an array of items using a specific key
@@ -1,4 +1,4 @@
1
- import { Key, KeyOrCallback, KeyOrCallbackKey, KeyOrCallbackValue, Simplify } from "../models.mjs";
1
+ import { Key, KeyOrCallback, KeyOrCallbackKey, KeyOrCallbackValue, Simplify } from "../models/index.mjs";
2
2
  //#region src/array/to-record.d.ts
3
3
  /**
4
4
  * Create a record from an array of items using a specific key
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/to-set.d.ts
3
3
  /**
4
4
  * Create a _Set_ from an array of items using a callback
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/toggle.d.ts
3
3
  /**
4
4
  * Toggle an item in an array
@@ -1,7 +1,8 @@
1
- import { SETS_COMPARE_UNION, compareSets } from "../internal/array/sets.mjs";
1
+ import { ARRAY_SETS_COMPARE_UNION } from "../models/array/array.misc.model.mjs";
2
+ import { compareSets } from "../internal/array/sets.mjs";
2
3
  //#region src/array/union.ts
3
4
  function union(first, second, key) {
4
- return compareSets(SETS_COMPARE_UNION, first, second, key);
5
+ return compareSets(ARRAY_SETS_COMPARE_UNION, first, second, key);
5
6
  }
6
7
  //#endregion
7
8
  export { union };
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/unique.d.ts
3
3
  /**
4
4
  * Get an array of unique items
@@ -1,8 +1,9 @@
1
- import { FIND_VALUES_UNIQUE, findValues } from "../internal/array/find.mjs";
1
+ import { ARRAY_FIND_VALUES_UNIQUE } from "../models/array/array.find.model.mjs";
2
+ import { findValues } from "../internal/array/find.mjs";
2
3
  //#region src/array/unique.ts
3
4
  function unique(array, key) {
4
5
  if (!Array.isArray(array)) return [];
5
- return array.length > 1 ? findValues(FIND_VALUES_UNIQUE, array, [key, void 0]).matched : array;
6
+ return array.length > 1 ? findValues(ARRAY_FIND_VALUES_UNIQUE, array, [key, void 0]).matched : array;
6
7
  }
7
8
  //#endregion
8
9
  export { unique };
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/array/update.d.ts
3
3
  /**
4
4
  * Update an item in an array