@simplysm/core-common 13.0.76 → 13.0.78

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 (126) hide show
  1. package/README.md +64 -21
  2. package/dist/extensions/arr-ext.d.ts +1 -1
  3. package/dist/extensions/arr-ext.d.ts.map +1 -1
  4. package/dist/extensions/arr-ext.helpers.d.ts +8 -0
  5. package/dist/extensions/arr-ext.helpers.d.ts.map +1 -1
  6. package/dist/extensions/arr-ext.helpers.js +65 -0
  7. package/dist/extensions/arr-ext.helpers.js.map +2 -2
  8. package/dist/extensions/arr-ext.js +16 -124
  9. package/dist/extensions/arr-ext.js.map +2 -2
  10. package/dist/extensions/arr-ext.types.d.ts +40 -32
  11. package/dist/extensions/arr-ext.types.d.ts.map +1 -1
  12. package/dist/extensions/map-ext.js.map +1 -1
  13. package/dist/extensions/set-ext.js.map +1 -1
  14. package/dist/features/event-emitter.d.ts +4 -4
  15. package/dist/features/event-emitter.d.ts.map +1 -1
  16. package/dist/features/event-emitter.js.map +1 -1
  17. package/dist/features/serial-queue.js +2 -2
  18. package/dist/features/serial-queue.js.map +1 -1
  19. package/dist/index.d.ts +13 -13
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +27 -13
  22. package/dist/index.js.map +1 -1
  23. package/dist/types/date-only.js +2 -2
  24. package/dist/types/date-only.js.map +1 -1
  25. package/dist/types/date-time.js +2 -2
  26. package/dist/types/date-time.js.map +1 -1
  27. package/dist/types/time.js +2 -2
  28. package/dist/types/time.js.map +1 -1
  29. package/dist/types/uuid.d.ts +2 -2
  30. package/dist/types/uuid.d.ts.map +1 -1
  31. package/dist/types/uuid.js +1 -1
  32. package/dist/types/uuid.js.map +1 -1
  33. package/dist/utils/bytes.d.ts +10 -10
  34. package/dist/utils/bytes.d.ts.map +1 -1
  35. package/dist/utils/bytes.js +10 -10
  36. package/dist/utils/bytes.js.map +1 -1
  37. package/dist/utils/date-format.d.ts +1 -1
  38. package/dist/utils/date-format.d.ts.map +1 -1
  39. package/dist/utils/date-format.js +2 -2
  40. package/dist/utils/date-format.js.map +1 -1
  41. package/dist/utils/error.d.ts +1 -1
  42. package/dist/utils/error.d.ts.map +1 -1
  43. package/dist/utils/error.js +2 -2
  44. package/dist/utils/error.js.map +1 -1
  45. package/dist/utils/json.d.ts +4 -2
  46. package/dist/utils/json.d.ts.map +1 -1
  47. package/dist/utils/json.js +9 -9
  48. package/dist/utils/json.js.map +1 -1
  49. package/dist/utils/num.d.ts +10 -10
  50. package/dist/utils/num.d.ts.map +1 -1
  51. package/dist/utils/num.js +11 -11
  52. package/dist/utils/num.js.map +1 -1
  53. package/dist/utils/obj.d.ts +40 -40
  54. package/dist/utils/obj.d.ts.map +1 -1
  55. package/dist/utils/obj.js +102 -99
  56. package/dist/utils/obj.js.map +1 -1
  57. package/dist/utils/path.d.ts +3 -3
  58. package/dist/utils/path.d.ts.map +1 -1
  59. package/dist/utils/path.js +6 -6
  60. package/dist/utils/path.js.map +1 -1
  61. package/dist/utils/primitive.d.ts +1 -1
  62. package/dist/utils/primitive.d.ts.map +1 -1
  63. package/dist/utils/primitive.js +2 -2
  64. package/dist/utils/primitive.js.map +1 -1
  65. package/dist/utils/str.d.ts +16 -16
  66. package/dist/utils/str.d.ts.map +1 -1
  67. package/dist/utils/str.js +16 -16
  68. package/dist/utils/str.js.map +1 -1
  69. package/dist/utils/transferable.d.ts +3 -3
  70. package/dist/utils/transferable.d.ts.map +1 -1
  71. package/dist/utils/transferable.js +10 -10
  72. package/dist/utils/transferable.js.map +1 -1
  73. package/dist/utils/wait.d.ts +2 -2
  74. package/dist/utils/wait.d.ts.map +1 -1
  75. package/dist/utils/wait.js +5 -5
  76. package/dist/utils/wait.js.map +1 -1
  77. package/dist/utils/xml.d.ts +2 -2
  78. package/dist/utils/xml.d.ts.map +1 -1
  79. package/dist/utils/xml.js +4 -4
  80. package/dist/utils/xml.js.map +1 -1
  81. package/dist/{zip/sd-zip.d.ts → utils/zip.d.ts} +1 -1
  82. package/dist/utils/zip.d.ts.map +1 -0
  83. package/dist/{zip/sd-zip.js → utils/zip.js} +1 -1
  84. package/dist/{zip/sd-zip.js.map → utils/zip.js.map} +1 -1
  85. package/package.json +1 -1
  86. package/src/extensions/arr-ext.helpers.ts +86 -0
  87. package/src/extensions/arr-ext.ts +22 -170
  88. package/src/extensions/arr-ext.types.ts +76 -48
  89. package/src/extensions/map-ext.ts +3 -3
  90. package/src/extensions/set-ext.ts +2 -2
  91. package/src/features/event-emitter.ts +6 -6
  92. package/src/features/serial-queue.ts +2 -2
  93. package/src/index.ts +16 -16
  94. package/src/types/date-only.ts +2 -2
  95. package/src/types/date-time.ts +2 -2
  96. package/src/types/time.ts +2 -2
  97. package/src/types/uuid.ts +2 -2
  98. package/src/utils/bytes.ts +15 -15
  99. package/src/utils/date-format.ts +1 -1
  100. package/src/utils/error.ts +1 -1
  101. package/src/utils/json.ts +9 -7
  102. package/src/utils/num.ts +15 -15
  103. package/src/utils/obj.ts +119 -116
  104. package/src/utils/path.ts +3 -3
  105. package/src/utils/primitive.ts +1 -1
  106. package/src/utils/str.ts +16 -16
  107. package/src/utils/transferable.ts +9 -9
  108. package/src/utils/wait.ts +3 -3
  109. package/src/utils/xml.ts +2 -2
  110. package/tests/extensions/array-extension.spec.ts +7 -5
  111. package/tests/types/uuid.spec.ts +4 -4
  112. package/tests/utils/bytes-utils.spec.ts +42 -49
  113. package/tests/utils/date-format.spec.ts +89 -88
  114. package/tests/utils/debounce-queue.spec.ts +3 -1
  115. package/tests/utils/json.spec.ts +61 -68
  116. package/tests/utils/number.spec.ts +41 -46
  117. package/tests/utils/object.spec.ts +120 -139
  118. package/tests/utils/path.spec.ts +19 -19
  119. package/tests/utils/primitive.spec.ts +12 -12
  120. package/tests/utils/string.spec.ts +66 -74
  121. package/tests/utils/transferable.spec.ts +55 -62
  122. package/tests/utils/wait.spec.ts +10 -10
  123. package/tests/utils/xml.spec.ts +25 -25
  124. package/dist/zip/sd-zip.d.ts.map +0 -1
  125. /package/src/{zip/sd-zip.ts → utils/zip.ts} +0 -0
  126. /package/tests/{zip/sd-zip.spec.ts → utils/zip.spec.ts} +0 -0
@@ -1,40 +1,21 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import {
3
- objClone as clone,
4
- objEqual,
5
- objMerge,
6
- objMerge3,
7
- objOmit,
8
- objOmitByFilter,
9
- objPick,
10
- objGetChainValue,
11
- objGetChainValueByDepth,
12
- objSetChainValue,
13
- objDeleteChainValue,
14
- objClearUndefined,
15
- objClear,
16
- objNullToUndefined,
17
- objUnflatten,
18
- DateTime,
19
- DateOnly,
20
- Uuid,
21
- } from "@simplysm/core-common";
2
+ import { obj as objU, DateTime, DateOnly, Uuid } from "@simplysm/core-common";
22
3
 
23
4
  describe("object utils", () => {
24
5
  //#region clone
25
6
 
26
7
  describe("objClone()", () => {
27
8
  it("Clones primitive values", () => {
28
- expect(clone(42)).toBe(42);
29
- expect(clone("hello")).toBe("hello");
30
- expect(clone(true)).toBe(true);
31
- expect(clone(null)).toBe(null);
32
- expect(clone(undefined)).toBe(undefined);
9
+ expect(objU.clone(42)).toBe(42);
10
+ expect(objU.clone("hello")).toBe("hello");
11
+ expect(objU.clone(true)).toBe(true);
12
+ expect(objU.clone(null)).toBe(null);
13
+ expect(objU.clone(undefined)).toBe(undefined);
33
14
  });
34
15
 
35
16
  it("Deep clones array", () => {
36
17
  const arr = [1, [2, 3], { a: 4 }];
37
- const cloned = clone(arr);
18
+ const cloned = objU.clone(arr);
38
19
 
39
20
  expect(cloned).toEqual(arr);
40
21
  expect(cloned).not.toBe(arr);
@@ -44,7 +25,7 @@ describe("object utils", () => {
44
25
 
45
26
  it("Deep clones object", () => {
46
27
  const obj = { a: 1, b: { c: 2 }, d: [3, 4] };
47
- const cloned = clone(obj);
28
+ const cloned = objU.clone(obj);
48
29
 
49
30
  expect(cloned).toEqual(obj);
50
31
  expect(cloned).not.toBe(obj);
@@ -54,7 +35,7 @@ describe("object utils", () => {
54
35
 
55
36
  it("Clones Date", () => {
56
37
  const date = new Date(2024, 2, 15);
57
- const cloned = clone(date);
38
+ const cloned = objU.clone(date);
58
39
 
59
40
  expect(cloned).toEqual(date);
60
41
  expect(cloned).not.toBe(date);
@@ -62,7 +43,7 @@ describe("object utils", () => {
62
43
 
63
44
  it("Clones DateTime", () => {
64
45
  const dt = new DateTime(2024, 3, 15, 10, 30);
65
- const cloned = clone(dt);
46
+ const cloned = objU.clone(dt);
66
47
 
67
48
  expect(cloned.tick).toBe(dt.tick);
68
49
  expect(cloned).not.toBe(dt);
@@ -70,15 +51,15 @@ describe("object utils", () => {
70
51
 
71
52
  it("Clones DateOnly", () => {
72
53
  const d = new DateOnly(2024, 3, 15);
73
- const cloned = clone(d);
54
+ const cloned = objU.clone(d);
74
55
 
75
56
  expect(cloned.tick).toBe(d.tick);
76
57
  expect(cloned).not.toBe(d);
77
58
  });
78
59
 
79
60
  it("Clones Uuid", () => {
80
- const uuid = Uuid.new();
81
- const cloned = clone(uuid);
61
+ const uuid = Uuid.generate();
62
+ const cloned = objU.clone(uuid);
82
63
 
83
64
  expect(cloned.toString()).toBe(uuid.toString());
84
65
  expect(cloned).not.toBe(uuid);
@@ -89,7 +70,7 @@ describe("object utils", () => {
89
70
  ["a", 1],
90
71
  ["b", { c: 2 }],
91
72
  ]);
92
- const cloned = clone(map);
73
+ const cloned = objU.clone(map);
93
74
 
94
75
  expect(cloned.get("a")).toBe(1);
95
76
  expect(cloned.get("b")).toEqual({ c: 2 });
@@ -99,7 +80,7 @@ describe("object utils", () => {
99
80
  it("Clones Set", () => {
100
81
  const obj = { a: 1 };
101
82
  const set = new Set([1, 2, obj]);
102
- const cloned = clone(set);
83
+ const cloned = objU.clone(set);
103
84
 
104
85
  expect(cloned.has(1)).toBe(true);
105
86
  expect(cloned.has(2)).toBe(true);
@@ -113,7 +94,7 @@ describe("object utils", () => {
113
94
  const obj: Record<string, unknown> = { a: 1 };
114
95
  obj["self"] = obj;
115
96
 
116
- const cloned = clone(obj);
97
+ const cloned = objU.clone(obj);
117
98
 
118
99
  expect(cloned["a"]).toBe(1);
119
100
  expect(cloned["self"]).toBe(cloned);
@@ -122,7 +103,7 @@ describe("object utils", () => {
122
103
 
123
104
  it("Clones RegExp", () => {
124
105
  const regex = /test/gi;
125
- const cloned = clone(regex);
106
+ const cloned = objU.clone(regex);
126
107
 
127
108
  expect(cloned).toEqual(regex);
128
109
  expect(cloned).not.toBe(regex);
@@ -132,7 +113,7 @@ describe("object utils", () => {
132
113
 
133
114
  it("Clones Error", () => {
134
115
  const error = new Error("test error");
135
- const cloned = clone(error);
116
+ const cloned = objU.clone(error);
136
117
 
137
118
  expect(cloned.message).toBe("test error");
138
119
  expect(cloned).not.toBe(error);
@@ -141,7 +122,7 @@ describe("object utils", () => {
141
122
  it("Clones Error cause", () => {
142
123
  const cause = new Error("cause error");
143
124
  const error = new Error("test error", { cause });
144
- const cloned = clone(error);
125
+ const cloned = objU.clone(error);
145
126
 
146
127
  expect(cloned.message).toBe("test error");
147
128
  expect(cloned.cause).toBeInstanceOf(Error);
@@ -152,7 +133,7 @@ describe("object utils", () => {
152
133
  const error = new Error("test") as Error & { code: string; detail: object };
153
134
  error.code = "ERR_CODE";
154
135
  error.detail = { key: "value" };
155
- const cloned = clone(error);
136
+ const cloned = objU.clone(error);
156
137
 
157
138
  expect(cloned.code).toBe("ERR_CODE");
158
139
  expect(cloned.detail).toEqual({ key: "value" });
@@ -161,7 +142,7 @@ describe("object utils", () => {
161
142
 
162
143
  it("Clones Uint8Array", () => {
163
144
  const arr = new Uint8Array([1, 2, 3, 4, 5]);
164
- const cloned = clone(arr);
145
+ const cloned = objU.clone(arr);
165
146
 
166
147
  expect(cloned).toEqual(arr);
167
148
  expect(cloned).not.toBe(arr);
@@ -172,7 +153,7 @@ describe("object utils", () => {
172
153
  // Object.keys() does not enumerate Symbol keys, so they are not cloned
173
154
  const sym = Symbol("test");
174
155
  const obj = { a: 1, [sym]: "symbol value" };
175
- const cloned = clone(obj);
156
+ const cloned = objU.clone(obj);
176
157
 
177
158
  expect(cloned.a).toBe(1);
178
159
  expect(cloned[sym]).toBeUndefined();
@@ -183,31 +164,31 @@ describe("object utils", () => {
183
164
 
184
165
  //#region equal
185
166
 
186
- describe("objEqual()", () => {
167
+ describe("objU.equal()", () => {
187
168
  it("Compares primitive values", () => {
188
- expect(objEqual(1, 1)).toBe(true);
189
- expect(objEqual(1, 2)).toBe(false);
190
- expect(objEqual("a", "a")).toBe(true);
191
- expect(objEqual(null, null)).toBe(true);
192
- expect(objEqual(undefined, undefined)).toBe(true);
193
- expect(objEqual(null, undefined)).toBe(false);
169
+ expect(objU.equal(1, 1)).toBe(true);
170
+ expect(objU.equal(1, 2)).toBe(false);
171
+ expect(objU.equal("a", "a")).toBe(true);
172
+ expect(objU.equal(null, null)).toBe(true);
173
+ expect(objU.equal(undefined, undefined)).toBe(true);
174
+ expect(objU.equal(null, undefined)).toBe(false);
194
175
  });
195
176
 
196
177
  it("Compares arrays", () => {
197
- expect(objEqual([1, 2, 3], [1, 2, 3])).toBe(true);
198
- expect(objEqual([1, 2, 3], [1, 2])).toBe(false);
199
- expect(objEqual([1, 2, 3], [1, 3, 2])).toBe(false);
178
+ expect(objU.equal([1, 2, 3], [1, 2, 3])).toBe(true);
179
+ expect(objU.equal([1, 2, 3], [1, 2])).toBe(false);
180
+ expect(objU.equal([1, 2, 3], [1, 3, 2])).toBe(false);
200
181
  });
201
182
 
202
183
  it("Compares objects", () => {
203
- expect(objEqual({ a: 1, b: 2 }, { a: 1, b: 2 })).toBe(true);
204
- expect(objEqual({ a: 1, b: 2 }, { a: 1, b: 3 })).toBe(false);
205
- expect(objEqual({ a: 1 }, { a: 1, b: 2 })).toBe(false);
184
+ expect(objU.equal({ a: 1, b: 2 }, { a: 1, b: 2 })).toBe(true);
185
+ expect(objU.equal({ a: 1, b: 2 }, { a: 1, b: 3 })).toBe(false);
186
+ expect(objU.equal({ a: 1 }, { a: 1, b: 2 })).toBe(false);
206
187
  });
207
188
 
208
189
  it("Compares nested objects", () => {
209
- expect(objEqual({ a: { b: { c: 1 } } }, { a: { b: { c: 1 } } })).toBe(true);
210
- expect(objEqual({ a: { b: { c: 1 } } }, { a: { b: { c: 2 } } })).toBe(false);
190
+ expect(objU.equal({ a: { b: { c: 1 } } }, { a: { b: { c: 1 } } })).toBe(true);
191
+ expect(objU.equal({ a: { b: { c: 1 } } }, { a: { b: { c: 2 } } })).toBe(false);
211
192
  });
212
193
 
213
194
  it("Compares DateTime", () => {
@@ -215,8 +196,8 @@ describe("object utils", () => {
215
196
  const dt2 = new DateTime(2024, 3, 15);
216
197
  const dt3 = new DateTime(2024, 3, 16);
217
198
 
218
- expect(objEqual(dt1, dt2)).toBe(true);
219
- expect(objEqual(dt1, dt3)).toBe(false);
199
+ expect(objU.equal(dt1, dt2)).toBe(true);
200
+ expect(objU.equal(dt1, dt3)).toBe(false);
220
201
  });
221
202
 
222
203
  it("Compares Uuid", () => {
@@ -224,8 +205,8 @@ describe("object utils", () => {
224
205
  const uuid2 = new Uuid("12345678-9abc-def0-1234-56789abcdef0");
225
206
  const uuid3 = new Uuid("12345678-9abc-def0-1234-56789abcdef1");
226
207
 
227
- expect(objEqual(uuid1, uuid2)).toBe(true);
228
- expect(objEqual(uuid1, uuid3)).toBe(false);
208
+ expect(objU.equal(uuid1, uuid2)).toBe(true);
209
+ expect(objU.equal(uuid1, uuid3)).toBe(false);
229
210
  });
230
211
 
231
212
  it("Compares RegExp", () => {
@@ -234,9 +215,9 @@ describe("object utils", () => {
234
215
  const regex3 = /test/g;
235
216
  const regex4 = /other/gi;
236
217
 
237
- expect(objEqual(regex1, regex2)).toBe(true);
238
- expect(objEqual(regex1, regex3)).toBe(false); // Different flags
239
- expect(objEqual(regex1, regex4)).toBe(false); // Different source
218
+ expect(objU.equal(regex1, regex2)).toBe(true);
219
+ expect(objU.equal(regex1, regex3)).toBe(false); // Different flags
220
+ expect(objU.equal(regex1, regex4)).toBe(false); // Different source
240
221
  });
241
222
 
242
223
  it("Compares Map", () => {
@@ -253,8 +234,8 @@ describe("object utils", () => {
253
234
  ["b", 3],
254
235
  ]);
255
236
 
256
- expect(objEqual(map1, map2)).toBe(true);
257
- expect(objEqual(map1, map3)).toBe(false);
237
+ expect(objU.equal(map1, map2)).toBe(true);
238
+ expect(objU.equal(map1, map3)).toBe(false);
258
239
  });
259
240
 
260
241
  it("Compares Set", () => {
@@ -262,37 +243,37 @@ describe("object utils", () => {
262
243
  const set2 = new Set([1, 2, 3]);
263
244
  const set3 = new Set([1, 2, 4]);
264
245
 
265
- expect(objEqual(set1, set2)).toBe(true);
266
- expect(objEqual(set1, set3)).toBe(false);
246
+ expect(objU.equal(set1, set2)).toBe(true);
247
+ expect(objU.equal(set1, set3)).toBe(false);
267
248
  });
268
249
 
269
250
  it("Compares only specific keys with topLevelIncludes option", () => {
270
251
  const obj1 = { a: 1, b: 2, c: 3 };
271
252
  const obj2 = { a: 1, b: 99, c: 99 };
272
253
 
273
- expect(objEqual(obj1, obj2, { topLevelIncludes: ["a"] })).toBe(true);
274
- expect(objEqual(obj1, obj2, { topLevelIncludes: ["a", "b"] })).toBe(false);
254
+ expect(objU.equal(obj1, obj2, { topLevelIncludes: ["a"] })).toBe(true);
255
+ expect(objU.equal(obj1, obj2, { topLevelIncludes: ["a", "b"] })).toBe(false);
275
256
  });
276
257
 
277
258
  it("Excludes specific keys with topLevelExcludes option", () => {
278
259
  const obj1 = { a: 1, b: 2, c: 3 };
279
260
  const obj2 = { a: 1, b: 99, c: 99 };
280
261
 
281
- expect(objEqual(obj1, obj2, { topLevelExcludes: ["b", "c"] })).toBe(true);
262
+ expect(objU.equal(obj1, obj2, { topLevelExcludes: ["b", "c"] })).toBe(true);
282
263
  });
283
264
 
284
265
  it("Ignores array order with ignoreArrayIndex option", () => {
285
- expect(objEqual([1, 2, 3], [3, 2, 1], { ignoreArrayIndex: true })).toBe(true);
266
+ expect(objU.equal([1, 2, 3], [3, 2, 1], { ignoreArrayIndex: true })).toBe(true);
286
267
  });
287
268
 
288
- it("Performs shallow comparison with onlyOneDepth option", () => {
269
+ it("Performs shallow comparison with shallow option", () => {
289
270
  const inner = { c: 1 };
290
271
  const obj1 = { a: 1, b: inner };
291
272
  const obj2 = { a: 1, b: inner };
292
273
  const obj3 = { a: 1, b: { c: 1 } };
293
274
 
294
- expect(objEqual(obj1, obj2, { onlyOneDepth: true })).toBe(true);
295
- expect(objEqual(obj1, obj3, { onlyOneDepth: true })).toBe(false);
275
+ expect(objU.equal(obj1, obj2, { shallow: true })).toBe(true);
276
+ expect(objU.equal(obj1, obj3, { shallow: true })).toBe(false);
296
277
  });
297
278
  });
298
279
 
@@ -300,10 +281,10 @@ describe("object utils", () => {
300
281
 
301
282
  //#region merge
302
283
 
303
- describe("objMerge()", () => {
284
+ describe("objU.merge()", () => {
304
285
  it("Copies target when source is null", () => {
305
286
  const target = { a: 1 };
306
- const result = objMerge(null, target);
287
+ const result = objU.merge(null, target);
307
288
 
308
289
  expect(result).toEqual({ a: 1 });
309
290
  expect(result).not.toBe(target);
@@ -311,7 +292,7 @@ describe("object utils", () => {
311
292
 
312
293
  it("Copies source when target is undefined", () => {
313
294
  const source = { a: 1 };
314
- const result = objMerge(source, undefined);
295
+ const result = objU.merge(source, undefined);
315
296
 
316
297
  expect(result).toEqual({ a: 1 });
317
298
  });
@@ -319,7 +300,7 @@ describe("object utils", () => {
319
300
  it("Merges objects", () => {
320
301
  const source = { a: 1, b: 2 };
321
302
  const target = { b: 3, c: 4 };
322
- const result = objMerge(source, target);
303
+ const result = objU.merge(source, target);
323
304
 
324
305
  expect(result).toEqual({ a: 1, b: 3, c: 4 });
325
306
  });
@@ -327,7 +308,7 @@ describe("object utils", () => {
327
308
  it("Merges nested objects", () => {
328
309
  const source = { a: { b: 1, c: 2 } };
329
310
  const target = { a: { c: 3, d: 4 } };
330
- const result = objMerge(source, target);
311
+ const result = objU.merge(source, target);
331
312
 
332
313
  expect(result).toEqual({ a: { b: 1, c: 3, d: 4 } });
333
314
  });
@@ -335,7 +316,7 @@ describe("object utils", () => {
335
316
  it("Replaces array with arrayProcess: replace", () => {
336
317
  const source = { arr: [1, 2, 3] };
337
318
  const target = { arr: [4, 5] };
338
- const result = objMerge(source, target, { arrayProcess: "replace" });
319
+ const result = objU.merge(source, target, { arrayProcess: "replace" });
339
320
 
340
321
  expect(result.arr).toEqual([4, 5]);
341
322
  });
@@ -343,7 +324,7 @@ describe("object utils", () => {
343
324
  it("Concatenates arrays with arrayProcess: concat", () => {
344
325
  const source = { arr: [1, 2, 3] };
345
326
  const target = { arr: [3, 4, 5] };
346
- const result = objMerge(source, target, { arrayProcess: "concat" });
327
+ const result = objU.merge(source, target, { arrayProcess: "concat" });
347
328
 
348
329
  // Duplicates removed via Set
349
330
  expect(result.arr).toEqual([1, 2, 3, 4, 5]);
@@ -352,7 +333,7 @@ describe("object utils", () => {
352
333
  it("Deletes when null with useDelTargetNull option", () => {
353
334
  const source = { a: 1, b: 2 };
354
335
  const target = { b: null };
355
- const result = objMerge(source, target, { useDelTargetNull: true });
336
+ const result = objU.merge(source, target, { useDelTargetNull: true });
356
337
 
357
338
  expect(result).toEqual({ a: 1 });
358
339
  });
@@ -361,7 +342,7 @@ describe("object utils", () => {
361
342
  const source = { a: 1 };
362
343
  const target = "string";
363
344
 
364
- const result = objMerge(source, target as any);
345
+ const result = objU.merge(source, target as any);
365
346
 
366
347
  expect(result).toBe("string");
367
348
  });
@@ -370,7 +351,7 @@ describe("object utils", () => {
370
351
  const source = "string";
371
352
  const target = { a: 1 };
372
353
 
373
- const result = objMerge(source as any, target);
354
+ const result = objU.merge(source as any, target);
374
355
 
375
356
  expect(result).toEqual({ a: 1 });
376
357
  });
@@ -379,7 +360,7 @@ describe("object utils", () => {
379
360
  const source = [1, 2, 3];
380
361
  const target = { a: 1 };
381
362
 
382
- const result = objMerge(source as any, target);
363
+ const result = objU.merge(source as any, target);
383
364
 
384
365
  expect(result).toEqual({ a: 1 });
385
366
  });
@@ -388,7 +369,7 @@ describe("object utils", () => {
388
369
  const source = { a: 1 };
389
370
  const target = [1, 2, 3];
390
371
 
391
- const result = objMerge(source as any, target);
372
+ const result = objU.merge(source as any, target);
392
373
 
393
374
  expect(result).toEqual([1, 2, 3]);
394
375
  });
@@ -418,7 +399,7 @@ describe("object utils", () => {
418
399
  },
419
400
  };
420
401
 
421
- const result = objMerge(source, target);
402
+ const result = objU.merge(source, target);
422
403
 
423
404
  expect(result).toEqual({
424
405
  level1: {
@@ -456,7 +437,7 @@ describe("object utils", () => {
456
437
  },
457
438
  };
458
439
 
459
- const result = objMerge(source, target);
440
+ const result = objU.merge(source, target);
460
441
 
461
442
  expect(result.a.b.c.d.value).toBe(2);
462
443
  });
@@ -466,7 +447,7 @@ describe("object utils", () => {
466
447
  const targetObj = { value: 2 };
467
448
  const targetMap = new Map<string, { value: number }>([["key2", targetObj]]);
468
449
 
469
- const result = objMerge(sourceMap, targetMap);
450
+ const result = objU.merge(sourceMap, targetMap);
470
451
 
471
452
  // key2 value is cloned, should be different reference
472
453
  expect(result.get("key2")).toEqual({ value: 2 });
@@ -474,12 +455,12 @@ describe("object utils", () => {
474
455
  });
475
456
  });
476
457
 
477
- describe("objMerge3()", () => {
458
+ describe("objU.merge3()", () => {
478
459
  it("Uses source value when only source changes", () => {
479
460
  const origin = { a: 1, b: 2 };
480
461
  const source = { a: 1, b: 3 };
481
462
  const target = { a: 1, b: 2 };
482
- const { conflict, result } = objMerge3(source, origin, target);
463
+ const { conflict, result } = objU.merge3(source, origin, target);
483
464
 
484
465
  expect(conflict).toBe(false);
485
466
  expect(result).toEqual({ a: 1, b: 3 });
@@ -489,7 +470,7 @@ describe("object utils", () => {
489
470
  const origin = { a: 1, b: 2 };
490
471
  const source = { a: 1, b: 2 };
491
472
  const target = { a: 1, b: 4 };
492
- const { conflict, result } = objMerge3(source, origin, target);
473
+ const { conflict, result } = objU.merge3(source, origin, target);
493
474
 
494
475
  expect(conflict).toBe(false);
495
476
  expect(result).toEqual({ a: 1, b: 4 });
@@ -499,7 +480,7 @@ describe("object utils", () => {
499
480
  const origin = { a: 1, b: 2 };
500
481
  const source = { a: 1, b: 5 };
501
482
  const target = { a: 1, b: 5 };
502
- const { conflict, result } = objMerge3(source, origin, target);
483
+ const { conflict, result } = objU.merge3(source, origin, target);
503
484
 
504
485
  expect(conflict).toBe(false);
505
486
  expect(result).toEqual({ a: 1, b: 5 });
@@ -509,7 +490,7 @@ describe("object utils", () => {
509
490
  const origin = { a: 1, b: 2 };
510
491
  const source = { a: 1, b: 3 };
511
492
  const target = { a: 1, b: 4 };
512
- const { conflict, result } = objMerge3(source, origin, target);
493
+ const { conflict, result } = objU.merge3(source, origin, target);
513
494
 
514
495
  expect(conflict).toBe(true);
515
496
  // Origin value preserved
@@ -520,7 +501,7 @@ describe("object utils", () => {
520
501
  const origin = { a: 1, b: 2, c: 3 };
521
502
  const source = { a: 10, b: 20, c: 3 };
522
503
  const target = { a: 1, b: 30, c: 4 };
523
- const { conflict, result } = objMerge3(source, origin, target);
504
+ const { conflict, result } = objU.merge3(source, origin, target);
524
505
 
525
506
  expect(conflict).toBe(true);
526
507
  expect(result.a).toBe(10); // Only source changed
@@ -532,7 +513,7 @@ describe("object utils", () => {
532
513
  const origin = { a: { b: 1, c: 2 } };
533
514
  const source = { a: { b: 10, c: 2 } };
534
515
  const target = { a: { b: 20, c: 2 } };
535
- const { conflict, result } = objMerge3(source, origin, target);
516
+ const { conflict, result } = objU.merge3(source, origin, target);
536
517
 
537
518
  expect(conflict).toBe(true);
538
519
  expect(result.a.b).toBe(1); // Both changed differently → conflict → origin preserved
@@ -545,7 +526,7 @@ describe("object utils", () => {
545
526
  const origin = { a: { b: 1, c: 2 } };
546
527
  const source = { a: { b: 10, c: 2 } };
547
528
  const target = { a: { b: 1, c: 20 } };
548
- const { conflict, result } = objMerge3(source, origin, target);
529
+ const { conflict, result } = objU.merge3(source, origin, target);
549
530
 
550
531
  expect(conflict).toBe(true);
551
532
  expect(result.a.b).toBe(1); // Conflict → origin preserved
@@ -556,7 +537,7 @@ describe("object utils", () => {
556
537
  const origin = { arr: [1, 2, 3] };
557
538
  const source = { arr: [1, 2, 4] };
558
539
  const target = { arr: [1, 2, 5] };
559
- const { conflict, result } = objMerge3(source, origin, target);
540
+ const { conflict, result } = objU.merge3(source, origin, target);
560
541
 
561
542
  expect(conflict).toBe(true);
562
543
  expect(result.arr).toEqual([1, 2, 3]); // Conflict → origin preserved
@@ -566,7 +547,7 @@ describe("object utils", () => {
566
547
  const origin = { value: "original" };
567
548
  const source = { value: "from source" };
568
549
  const target = { value: "from target" };
569
- const { conflict, result } = objMerge3(source, origin, target);
550
+ const { conflict, result } = objU.merge3(source, origin, target);
570
551
 
571
552
  expect(conflict).toBe(true);
572
553
  expect(result.value).toBe("original"); // Conflict → origin preserved
@@ -577,35 +558,35 @@ describe("object utils", () => {
577
558
 
578
559
  //#region omit / pick
579
560
 
580
- describe("objOmit()", () => {
561
+ describe("objU.omit()", () => {
581
562
  it("Excludes specific keys", () => {
582
563
  const obj = { a: 1, b: 2, c: 3 };
583
- const result = objOmit(obj, ["b"]);
564
+ const result = objU.omit(obj, ["b"]);
584
565
 
585
566
  expect(result).toEqual({ a: 1, c: 3 });
586
567
  });
587
568
 
588
569
  it("Excludes multiple keys", () => {
589
570
  const obj = { a: 1, b: 2, c: 3, d: 4 };
590
- const result = objOmit(obj, ["a", "c"]);
571
+ const result = objU.omit(obj, ["a", "c"]);
591
572
 
592
573
  expect(result).toEqual({ b: 2, d: 4 });
593
574
  });
594
575
  });
595
576
 
596
- describe("objOmitByFilter()", () => {
577
+ describe("objU.omitByFilter()", () => {
597
578
  it("Excludes keys matching condition", () => {
598
579
  const obj = { a: 1, b: 2, c: 3 };
599
- const result = objOmitByFilter(obj, (key) => key === "b");
580
+ const result = objU.omitByFilter(obj, (key) => key === "b");
600
581
 
601
582
  expect(result).toEqual({ a: 1, c: 3 });
602
583
  });
603
584
  });
604
585
 
605
- describe("objPick()", () => {
586
+ describe("objU.pick()", () => {
606
587
  it("Selects only specific keys", () => {
607
588
  const obj = { a: 1, b: 2, c: 3 };
608
- const result = objPick(obj, ["a", "c"]);
589
+ const result = objU.pick(obj, ["a", "c"]);
609
590
 
610
591
  expect(result).toEqual({ a: 1, c: 3 });
611
592
  });
@@ -615,27 +596,27 @@ describe("object utils", () => {
615
596
 
616
597
  //#region chain value
617
598
 
618
- describe("objGetChainValue()", () => {
599
+ describe("objU.getChainValue()", () => {
619
600
  it("Gets value using dot notation", () => {
620
601
  const obj = { a: { b: { c: 1 } } };
621
602
 
622
- expect(objGetChainValue(obj, "a.b.c")).toBe(1);
603
+ expect(objU.getChainValue(obj, "a.b.c")).toBe(1);
623
604
  });
624
605
 
625
606
  it("Gets value using array notation", () => {
626
607
  const obj = { arr: [{ name: "first" }, { name: "second" }] };
627
608
 
628
- expect(objGetChainValue(obj, "arr[1].name")).toBe("second");
609
+ expect(objU.getChainValue(obj, "arr[1].name")).toBe("second");
629
610
  });
630
611
 
631
612
  it("Returns undefined for non-existent path with optional: true", () => {
632
613
  const obj = { a: 1 };
633
614
 
634
- expect(objGetChainValue(obj, "b.c.d", true)).toBe(undefined);
615
+ expect(objU.getChainValue(obj, "b.c.d", true)).toBe(undefined);
635
616
  });
636
617
  });
637
618
 
638
- describe("objGetChainValueByDepth()", () => {
619
+ describe("objU.getChainValueByDepth()", () => {
639
620
  it("Descends by depth using same key", () => {
640
621
  const obj = {
641
622
  parent: {
@@ -647,7 +628,7 @@ describe("object utils", () => {
647
628
  },
648
629
  };
649
630
 
650
- const result = objGetChainValueByDepth(obj, "parent", 2);
631
+ const result = objU.getChainValueByDepth(obj, "parent", 2);
651
632
 
652
633
  expect(result).toEqual({ parent: { name: "leaf" } });
653
634
  });
@@ -655,7 +636,7 @@ describe("object utils", () => {
655
636
  it("Throws error when depth is 0", () => {
656
637
  const obj = { parent: { name: "child" } };
657
638
 
658
- expect(() => objGetChainValueByDepth(obj, "parent", 0)).toThrow(
639
+ expect(() => objU.getChainValueByDepth(obj, "parent", 0)).toThrow(
659
640
  "depth must be 1 or greater",
660
641
  );
661
642
  });
@@ -663,7 +644,7 @@ describe("object utils", () => {
663
644
  it("Descends one level when depth is 1", () => {
664
645
  const obj = { parent: { name: "child" } };
665
646
 
666
- const result = objGetChainValueByDepth(obj, "parent", 1);
647
+ const result = objU.getChainValueByDepth(obj, "parent", 1);
667
648
 
668
649
  expect(result).toEqual({ name: "child" });
669
650
  });
@@ -671,7 +652,7 @@ describe("object utils", () => {
671
652
  it("Returns undefined when intermediate path missing with optional: true", () => {
672
653
  const obj = { parent: { name: "child" } };
673
654
 
674
- const result = objGetChainValueByDepth(obj, "parent", 5, true);
655
+ const result = objU.getChainValueByDepth(obj, "parent", 5, true);
675
656
 
676
657
  expect(result).toBe(undefined);
677
658
  });
@@ -682,21 +663,21 @@ describe("object utils", () => {
682
663
  // Without optional, trying to access property on undefined throws error
683
664
  // Current implementation only checks result == null inside optional condition
684
665
  // So without optional, error is possible
685
- expect(() => objGetChainValueByDepth(obj as any, "parent", 2)).toThrow();
666
+ expect(() => objU.getChainValueByDepth(obj as any, "parent", 2)).toThrow();
686
667
  });
687
668
  });
688
669
 
689
- describe("objSetChainValue()", () => {
670
+ describe("objU.setChainValue()", () => {
690
671
  it("Sets value using dot notation", () => {
691
672
  const obj: Record<string, unknown> = {};
692
- objSetChainValue(obj, "a.b.c", 1);
673
+ objU.setChainValue(obj, "a.b.c", 1);
693
674
 
694
675
  expect(obj).toEqual({ a: { b: { c: 1 } } });
695
676
  });
696
677
 
697
678
  it("Overwrites existing value", () => {
698
679
  const obj = { a: { b: { c: 1 } } };
699
- objSetChainValue(obj, "a.b.c", 2);
680
+ objU.setChainValue(obj, "a.b.c", 2);
700
681
 
701
682
  expect(obj.a.b.c).toBe(2);
702
683
  });
@@ -704,14 +685,14 @@ describe("object utils", () => {
704
685
  it("Throws error for empty chain", () => {
705
686
  const obj: Record<string, unknown> = {};
706
687
 
707
- expect(() => objSetChainValue(obj, "", 1)).toThrow();
688
+ expect(() => objU.setChainValue(obj, "", 1)).toThrow();
708
689
  });
709
690
  });
710
691
 
711
- describe("objDeleteChainValue()", () => {
692
+ describe("objU.deleteChainValue()", () => {
712
693
  it("Deletes value at chain path", () => {
713
694
  const obj = { a: { b: { c: 1, d: 2 } } };
714
- objDeleteChainValue(obj, "a.b.c");
695
+ objU.deleteChainValue(obj, "a.b.c");
715
696
 
716
697
  expect(obj.a.b).toEqual({ d: 2 });
717
698
  });
@@ -720,27 +701,27 @@ describe("object utils", () => {
720
701
  const obj = { a: 1 };
721
702
 
722
703
  // No error when intermediate path missing
723
- expect(() => objDeleteChainValue(obj, "b.c.d")).not.toThrow();
704
+ expect(() => objU.deleteChainValue(obj, "b.c.d")).not.toThrow();
724
705
  expect(obj).toEqual({ a: 1 });
725
706
  });
726
707
 
727
708
  it("Silently ignores undefined intermediate path", () => {
728
709
  const obj: Record<string, unknown> = { a: undefined };
729
710
 
730
- expect(() => objDeleteChainValue(obj, "a.b.c")).not.toThrow();
711
+ expect(() => objU.deleteChainValue(obj, "a.b.c")).not.toThrow();
731
712
  expect(obj).toEqual({ a: undefined });
732
713
  });
733
714
 
734
715
  it("Silently ignores null intermediate path", () => {
735
716
  const obj: Record<string, unknown> = { a: null };
736
717
 
737
- expect(() => objDeleteChainValue(obj, "a.b.c")).not.toThrow();
718
+ expect(() => objU.deleteChainValue(obj, "a.b.c")).not.toThrow();
738
719
  expect(obj).toEqual({ a: null });
739
720
  });
740
721
 
741
722
  it("Deletes using array index path", () => {
742
723
  const obj = { arr: [{ name: "first" }, { name: "second" }] };
743
- objDeleteChainValue(obj, "arr[0].name");
724
+ objU.deleteChainValue(obj, "arr[0].name");
744
725
 
745
726
  expect(obj.arr[0]).toEqual({});
746
727
  expect(obj.arr[1]).toEqual({ name: "second" });
@@ -749,7 +730,7 @@ describe("object utils", () => {
749
730
  it("Throws error for empty chain", () => {
750
731
  const obj = { a: 1 };
751
732
 
752
- expect(() => objDeleteChainValue(obj, "")).toThrow();
733
+ expect(() => objU.deleteChainValue(obj, "")).toThrow();
753
734
  });
754
735
  });
755
736
 
@@ -757,40 +738,40 @@ describe("object utils", () => {
757
738
 
758
739
  //#region clear / transform
759
740
 
760
- describe("objClearUndefined()", () => {
741
+ describe("objU.clearUndefined()", () => {
761
742
  it("Deletes keys with undefined value", () => {
762
743
  const obj = { a: 1, b: undefined, c: 3 };
763
- const result = objClearUndefined(obj);
744
+ const result = objU.clearUndefined(obj);
764
745
 
765
746
  expect(result).toEqual({ a: 1, c: 3 });
766
747
  expect("b" in result).toBe(false);
767
748
  });
768
749
  });
769
750
 
770
- describe("objClear()", () => {
751
+ describe("objU.clear()", () => {
771
752
  it("Deletes all keys", () => {
772
753
  const obj = { a: 1, b: 2, c: 3 };
773
- const result = objClear(obj);
754
+ const result = objU.clear(obj);
774
755
 
775
756
  expect(Object.keys(result)).toHaveLength(0);
776
757
  });
777
758
  });
778
759
 
779
- describe("objNullToUndefined()", () => {
760
+ describe("objU.nullToUndefined()", () => {
780
761
  it("Converts null to undefined", () => {
781
- expect(objNullToUndefined(null)).toBe(undefined);
762
+ expect(objU.nullToUndefined(null)).toBe(undefined);
782
763
  });
783
764
 
784
765
  it("Converts nested null to undefined", () => {
785
766
  const obj = { a: 1, b: null, c: { d: null } };
786
- const result = objNullToUndefined(obj);
767
+ const result = objU.nullToUndefined(obj);
787
768
 
788
769
  expect(result).toEqual({ a: 1, b: undefined, c: { d: undefined } });
789
770
  });
790
771
 
791
772
  it("Converts null in array to undefined", () => {
792
773
  const arr = [1, null, { a: null }];
793
- const result = objNullToUndefined(arr);
774
+ const result = objU.nullToUndefined(arr);
794
775
 
795
776
  expect(result).toEqual([1, undefined, { a: undefined }]);
796
777
  });
@@ -798,7 +779,7 @@ describe("object utils", () => {
798
779
  it("Safely handles object with circular references", () => {
799
780
  const obj: Record<string, unknown> = { a: null };
800
781
  obj["self"] = obj;
801
- const result = objNullToUndefined(obj);
782
+ const result = objU.nullToUndefined(obj);
802
783
  expect(result).toBeDefined();
803
784
  expect((result as Record<string, unknown>)["a"]).toBeUndefined();
804
785
  });
@@ -806,17 +787,17 @@ describe("object utils", () => {
806
787
  it("Safely handles array with circular references", () => {
807
788
  const arr: unknown[] = [null, 1];
808
789
  arr.push(arr);
809
- const result = objNullToUndefined(arr);
790
+ const result = objU.nullToUndefined(arr);
810
791
  expect(result).toBeDefined();
811
792
  expect((result as unknown[])[0]).toBeUndefined();
812
793
  expect((result as unknown[])[1]).toBe(1);
813
794
  });
814
795
  });
815
796
 
816
- describe("objUnflatten()", () => {
797
+ describe("objU.unflatten()", () => {
817
798
  it("Converts flattened object to nested", () => {
818
799
  const flat = { "a.b.c": 1, "a.b.d": 2, "e": 3 };
819
- const result = objUnflatten(flat);
800
+ const result = objU.unflatten(flat);
820
801
 
821
802
  expect(result).toEqual({
822
803
  a: { b: { c: 1, d: 2 } },