@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,67 +1,8 @@
1
- import { ArrayOrPlainObject, NestedPartial, PlainObject, UnionToIntersection } from "../models.mjs";
1
+ import { ArrayOrPlainObject, PlainObject, UnionToIntersection } from "../models/index.mjs";
2
+ import { AssignOptions, Assigner, MergeOptions, Merger, MergingOptions } from "../models/value/value.merge.model.mjs";
2
3
  //#region src/value/merge.d.ts
3
- /**
4
- * Options for assigning values
5
- */
6
- export type AssignOptions = Omit<MergeOptions, "assignValues">;
7
- /**
8
- * An assigner function for assigning values from one or more objects to the first one
9
- */
10
- export type Assigner = {
11
- /**
12
- * Assign values from one or more objects to the first one
13
- *
14
- * @param to Value to assign to
15
- * @param from Values to assign
16
- * @returns Assigned value
17
- */
18
- assign<To extends PlainObject, From extends PlainObject[]>(to: To, from: [...From]): To & UnionToIntersection<From[number]>;
19
- };
20
- /**
21
- * Options for merging values
22
- */
23
- export type MergeOptions = {
24
- /**
25
- * Assign values to the first array or object instead of creating a new one?
26
- */
27
- assignValues?: boolean;
28
- /**
29
- * Key _(or key epxressions)_ for values that should be replaced
30
- *
31
- * ```ts
32
- * merge([{items: [1, 2, 3]}, {items: [99]}]); // => {items: [99]}
33
- * ```
34
- */
35
- replaceableObjects?: string | RegExp | Array<string | RegExp>;
36
- /**
37
- * Skip nullable values when merging objects?
38
- *
39
- * ```ts
40
- * merge({a: 1, b: 2}, {b: null, c: 3}, {d: null}); // => {a: 1, b: 2, c: 3}
41
- * ```
42
- */
43
- skipNullableAny?: boolean;
44
- /**
45
- * Skip nullable values when merging arrays?
46
- *
47
- * ```ts
48
- * merge([1, 2, 3], [null, null, 99]); // => [1, 2, 99]
49
- * ```
50
- */
51
- skipNullableInArrays?: boolean;
52
- };
53
- /**
54
- * A merger function for merging multiple arrays or objects into a single one
55
- */
56
- export type Merger = {
57
- /**
58
- * Merge multiple arrays or objects into a single one
59
- *
60
- * @param values Values to merge
61
- * @returns Merged value
62
- */
63
- merge<Values extends ArrayOrPlainObject[]>(values: Array<NestedPartial<Values[number]>>): UnionToIntersection<Values[number]>;
64
- };
4
+ declare function Assigner(this: any, options: MergingOptions): void;
5
+ declare function Merger(this: any, options: MergingOptions): void;
65
6
  /**
66
7
  * Assign values from one or more objects to the first one
67
8
  *
@@ -103,4 +44,5 @@ export declare namespace assign {
103
44
  export declare namespace merge {
104
45
  export var initialize: typeof initializeMerger;
105
46
  }
106
- //#endregion
47
+ //#endregion
48
+ export type { AssignOptions, Assigner, MergeOptions, Merger };
@@ -1,4 +1,5 @@
1
1
  import { isArrayOrPlainObject } from "../internal/is.mjs";
2
+ import { MERGE_SYMBOL_ASSIGN, MERGE_SYMBOL_MERGE } from "../models/value/value.merge.model.mjs";
2
3
  //#region src/value/merge.ts
3
4
  function Assigner(options) {
4
5
  this[MERGE_SYMBOL_ASSIGN] = {
@@ -20,21 +21,22 @@ Merger.prototype.merge = mergeFromMerger;
20
21
  * @returns Assigned value
21
22
  */
22
23
  function assign(to, from, options) {
23
- const actual = createMergeOptions(options);
24
+ const actual = createMergingOptions(options);
24
25
  actual.assignValues = true;
25
26
  return mergeValues([to, ...from], actual);
26
27
  }
27
28
  function assignFromAssigner(to, from) {
28
29
  return mergeValues([to, ...from], this[MERGE_SYMBOL_ASSIGN]);
29
30
  }
30
- function createMergeOptions(options) {
31
+ function createMergingOptions(input) {
31
32
  const actual = {
32
33
  assignValues: false,
33
34
  replaceableObjects: void 0,
34
35
  skipNullableAny: false,
35
36
  skipNullableInArrays: false
36
37
  };
37
- if (typeof options !== "object" || options == null) return actual;
38
+ if (typeof input !== "object" || input == null) return actual;
39
+ const options = input;
38
40
  actual.replaceableObjects = getReplaceableObjects(options.replaceableObjects);
39
41
  actual.assignValues = options.assignValues === true;
40
42
  actual.skipNullableAny = options.skipNullableAny === true;
@@ -55,7 +57,7 @@ function getReplaceableObjects(value) {
55
57
  * @returns Assigner function
56
58
  */
57
59
  function initializeAssigner(options) {
58
- return new Assigner(createMergeOptions(options));
60
+ return new Assigner(createMergingOptions(options));
59
61
  }
60
62
  /**
61
63
  * Create a merger with predefined options
@@ -66,7 +68,7 @@ function initializeAssigner(options) {
66
68
  * @returns Merger function
67
69
  */
68
70
  function initializeMerger(options) {
69
- return new Merger(createMergeOptions(options));
71
+ return new Merger(createMergingOptions(options));
70
72
  }
71
73
  /**
72
74
  * Merge multiple arrays or objects into a single one
@@ -76,7 +78,7 @@ function initializeMerger(options) {
76
78
  * @returns Merged value
77
79
  */
78
80
  function merge(values, options) {
79
- return mergeValues(values, createMergeOptions(options));
81
+ return mergeValues(values, createMergingOptions(options));
80
82
  }
81
83
  function mergeFromMerger(values) {
82
84
  return mergeValues(values, this[MERGE_SYMBOL_MERGE]);
@@ -110,8 +112,6 @@ function mergeValues(values, options, prefix) {
110
112
  if (actual.length > 1) return mergeObjects(actual, options, options.assignValues ? actual[0] : void 0, prefix);
111
113
  return options.assignValues ? actual[0] : Array.isArray(actual[0]) ? actual[0].slice() : { ...actual[0] };
112
114
  }
113
- const MERGE_SYMBOL_ASSIGN = Symbol("assign");
114
- const MERGE_SYMBOL_MERGE = Symbol("merge");
115
115
  assign.initialize = initializeAssigner;
116
116
  merge.initialize = initializeMerger;
117
117
  //#endregion
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/value/omit.d.ts
3
3
  /**
4
4
  * Create a new object without the specified keys
@@ -1,4 +1,4 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
2
  //#region src/value/pick.d.ts
3
3
  /**
4
4
  * Create a new object with only the specified keys
@@ -1,9 +1,6 @@
1
- import { PlainObject, Simplify } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
+ import { Shaken } from "../models/value/value.misc.model.mjs";
2
3
  //#region src/value/shake.d.ts
3
- /**
4
- * A shaken object, without any `undefined` values
5
- */
6
- export type Shaken<Value extends PlainObject> = Simplify<{ [Key in keyof Value as undefined extends Value[Key] ? never : Key]: Value[Key]; } & { [Key in keyof Value as undefined extends Value[Key] ? [Value[Key]] extends [undefined] ? never : Key : never]?: Exclude<Value[Key], undefined>; }>;
7
4
  /**
8
5
  * Shake an object, removing all keys with `undefined` values
9
6
  *
@@ -11,4 +8,5 @@ export type Shaken<Value extends PlainObject> = Simplify<{ [Key in keyof Value a
11
8
  * @returns Shaken object
12
9
  */
13
10
  export declare function shake<Value extends PlainObject>(value: Value): Shaken<Value>;
14
- //#endregion
11
+ //#endregion
12
+ export type { Shaken };
@@ -1,9 +1,6 @@
1
- import { NestedKeys, NestedValue, PlainObject, Simplify, ToString } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
+ import { Smushed } from "../models/value/value.misc.model.mjs";
2
3
  //#region src/value/smush.d.ts
3
- /**
4
- * A smushed object, with all nested objects flattened into a single level, using dot notation keys
5
- */
6
- export type Smushed<Value extends PlainObject> = Simplify<{ [NestedKey in NestedKeys<Value>]: NestedValue<Value, ToString<NestedKey>>; }>;
7
4
  /**
8
5
  * Smush an object into a flat object that uses dot notation keys
9
6
  *
@@ -11,4 +8,5 @@ export type Smushed<Value extends PlainObject> = Simplify<{ [NestedKey in Nested
11
8
  * @returns Smushed object with dot notation keys
12
9
  */
13
10
  export declare function smush<Value extends PlainObject>(value: Value): Smushed<Value>;
14
- //#endregion
11
+ //#endregion
12
+ export type { Smushed };
@@ -1,8 +1,9 @@
1
1
  import { isArrayOrPlainObject } from "../internal/is.mjs";
2
+ import "../models/value/value.misc.model.mjs";
2
3
  import { join } from "../internal/string/misc.mjs";
3
4
  //#region src/value/smush.ts
4
5
  function flattenObject(value, depth, smushed, prefix) {
5
- if (depth >= SMUSH_MAX_DEPTH) return {};
6
+ if (depth >= 100) return {};
6
7
  if (smushed.has(value)) return smushed.get(value);
7
8
  const keys = Object.keys(value);
8
9
  const { length } = keys;
@@ -34,6 +35,5 @@ function flattenObject(value, depth, smushed, prefix) {
34
35
  function smush(value) {
35
36
  return typeof value === "object" && value !== null ? flattenObject(value, 0, /* @__PURE__ */ new WeakMap()) : {};
36
37
  }
37
- const SMUSH_MAX_DEPTH = 100;
38
38
  //#endregion
39
39
  export { smush };
@@ -1,25 +1,8 @@
1
- import { PlainObject } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
+ import { TransformCallback, TransformCallbacks, TransformHandler } from "../models/value/value.transform.model.mjs";
2
3
  //#region src/value/transform.d.ts
3
- /**
4
- * A callback transform an object's properties
5
- */
6
- type TransformCallback<Value extends PlainObject, Key extends keyof Value> = (key: Key, value: Value[Key]) => Value[Key];
7
- /**
8
- * A collection of keyed callbacks to transform an object's properties
9
- */
10
- type TransformCallbacks<Value extends PlainObject> = Partial<{ [Key in keyof Value]: (value: Value[Key]) => Value[Key]; }>;
11
- /**
12
- * A transformer for an object, with predefined callbacks for transforming its properties
13
- */
14
- export type Transformer<Value extends PlainObject> = {
15
- /**
16
- * Transform an object's properties
17
- *
18
- * @param value Object to transform
19
- * @returns Transformed object
20
- */
21
- transform(value: Value): Value;
22
- };
4
+ declare function Transformer(this: any, transformer: ReturnType<typeof getTransformHandler>): void;
5
+ declare function getTransformHandler<Value extends PlainObject, Key extends keyof Value>(input: unknown): TransformHandler<Value> | undefined;
23
6
  /**
24
7
  * Initialize a transformer for an object with a transformer function
25
8
  *
@@ -57,4 +40,5 @@ export declare function transform<Value extends PlainObject>(value: Value, trans
57
40
  export declare namespace transform {
58
41
  export var initialize: typeof initializeTransformer;
59
42
  }
60
- //#endregion
43
+ //#endregion
44
+ export type { TransformCallback, TransformCallbacks, Transformer };
@@ -1,4 +1,5 @@
1
1
  import { isNonPlainObject } from "../internal/is.mjs";
2
+ import { TRANSFORM_SYMBOL } from "../models/value/value.transform.model.mjs";
2
3
  //#region src/value/transform.ts
3
4
  function Transformer(transformer) {
4
5
  this[TRANSFORM_SYMBOL] = transformer;
@@ -37,7 +38,6 @@ function transformValue(value) {
37
38
  }
38
39
  return value;
39
40
  }
40
- const TRANSFORM_SYMBOL = Symbol("transform");
41
41
  transform.initialize = initializeTransformer;
42
42
  //#endregion
43
43
  export { initializeTransformer, transform };
@@ -1,13 +1,6 @@
1
- import { PlainObject, Simplify, UnionToIntersection } from "../models.mjs";
1
+ import { PlainObject } from "../models/index.mjs";
2
+ import { Unsmushed } from "../models/value/value.misc.model.mjs";
2
3
  //#region src/value/unsmush.d.ts
3
- /**
4
- * Thanks, type-fest!
5
- */
6
- type KeysOfUnion<ObjectType> = keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;
7
- /**
8
- * An unsmushed object, with all dot notation keys turned into nested keys
9
- */
10
- export type Unsmushed<Value extends PlainObject> = Simplify<Omit<{ [UnionKey in KeysOfUnion<Value>]: Value[UnionKey]; }, `${string}.${string}`>>;
11
4
  /**
12
5
  * Unsmush a smushed object _(turning dot notation keys into nested keys)_
13
6
  *
@@ -15,4 +8,5 @@ export type Unsmushed<Value extends PlainObject> = Simplify<Omit<{ [UnionKey in
15
8
  * @returns Unsmushed object with nested keys
16
9
  */
17
10
  export declare function unsmush<Value extends PlainObject>(value: Value): Unsmushed<Value>;
18
- //#endregion
11
+ //#endregion
12
+ export type { Unsmushed };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscarpalmer/atoms",
3
- "version": "0.213.0",
3
+ "version": "0.214.0",
4
4
  "description": "Atomic utilities for making your JavaScript better.",
5
5
  "keywords": [
6
6
  "array",
@@ -30,6 +30,7 @@
30
30
  "plugin"
31
31
  ],
32
32
  "type": "module",
33
+ "sideEffects": false,
33
34
  "module": "./dist/index.mjs",
34
35
  "types": "./dist/index.d.mts",
35
36
  "exports": {
@@ -143,7 +144,7 @@
143
144
  "default": "./dist/math.mjs"
144
145
  },
145
146
  "./models": {
146
- "types": "./dist/models.d.mts"
147
+ "types": "./dist/models/index.d.mts"
147
148
  },
148
149
  "./number": {
149
150
  "types": "./dist/number.d.mts",
@@ -164,6 +165,14 @@
164
165
  "./plan/models": {
165
166
  "default": "./dist/plan/models.mjs"
166
167
  },
168
+ "./plan/result": {
169
+ "types": "./dist/plan/result.d.mts",
170
+ "default": "./dist/plan/result.mjs"
171
+ },
172
+ "./plan/run": {
173
+ "types": "./dist/plan/run.d.mts",
174
+ "default": "./dist/plan/run.mjs"
175
+ },
167
176
  "./promise": {
168
177
  "types": "./dist/promise/index.d.mts",
169
178
  "default": "./dist/promise/index.mjs"
@@ -212,7 +221,7 @@
212
221
  "default": "./dist/result/misc.mjs"
213
222
  },
214
223
  "./result/models": {
215
- "default": "./dist/internal/models/result.model.mjs"
224
+ "default": "./dist/models/result.model.mjs"
216
225
  },
217
226
  "./result/pipe": {
218
227
  "types": "./dist/result/work/pipe.d.mts",
@@ -295,7 +304,6 @@
295
304
  "default": "./dist/value/transform.mjs"
296
305
  }
297
306
  },
298
- "sideEffects": false,
299
307
  "scripts": {
300
308
  "build": "npx vp pack && npm run tsdown:build",
301
309
  "tsdown:build": "npx tsdown -c ./tsdown.config.ts",
@@ -1,17 +0,0 @@
1
- import { PromiseStrategy } from "./models.mjs";
2
- //#region src/promise/constants.d.ts
3
- export declare const PROMISE_ABORT_EVENT = "abort";
4
- export declare const PROMISE_ABORT_OPTIONS: {
5
- once: boolean;
6
- };
7
- export declare const PROMISE_ERROR_NAME = "PromiseTimeoutError";
8
- export declare const PROMISE_MESSAGE_EXPECTATION_ATTEMPT = "Attempt expected a function or a promise";
9
- export declare const PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE = "promises expected an array or object holding promise-functions or promises";
10
- export declare const PROMISE_MESSAGE_EXPECTATION_RESULT = "toResult expected a Promise";
11
- export declare const PROMISE_MESSAGE_EXPECTATION_TIMED = "Timed function expected a Promise";
12
- export declare const PROMISE_MESSAGE_TIMEOUT = "Promise timed out";
13
- export declare const PROMISE_STRATEGY_ALL: Set<PromiseStrategy>;
14
- export declare const PROMISE_STRATEGY_DEFAULT: PromiseStrategy;
15
- export declare const PROMISE_TYPE_FULFILLED = "fulfilled";
16
- export declare const PROMISE_TYPE_REJECTED = "rejected";
17
- //#endregion
@@ -1,15 +0,0 @@
1
- //#region src/promise/constants.ts
2
- const PROMISE_ABORT_EVENT = "abort";
3
- const PROMISE_ABORT_OPTIONS = { once: true };
4
- const PROMISE_ERROR_NAME = "PromiseTimeoutError";
5
- const PROMISE_MESSAGE_EXPECTATION_ATTEMPT = "Attempt expected a function or a promise";
6
- const PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE = "promises expected an array or object holding promise-functions or promises";
7
- const PROMISE_MESSAGE_EXPECTATION_RESULT = "toResult expected a Promise";
8
- const PROMISE_MESSAGE_EXPECTATION_TIMED = "Timed function expected a Promise";
9
- const PROMISE_MESSAGE_TIMEOUT = "Promise timed out";
10
- const PROMISE_STRATEGY_ALL = /* @__PURE__ */ new Set(["complete", "first"]);
11
- const PROMISE_STRATEGY_DEFAULT = "complete";
12
- const PROMISE_TYPE_FULFILLED = "fulfilled";
13
- const PROMISE_TYPE_REJECTED = "rejected";
14
- //#endregion
15
- export { PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED };
File without changes