es-toolkit 1.36.0 → 1.37.0-dev.1241

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 (45) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/_chunk/isPlainObject-Xaozpc.js +93 -0
  3. package/dist/_chunk/{isPromise-CxqI1v.js → isWeakSet-C2NpfO.js} +91 -177
  4. package/dist/_chunk/snakeCase-BwvoPi.js +30 -0
  5. package/dist/_chunk/toSnakeCaseKeys-kqZCyq.js +379 -0
  6. package/dist/_chunk/{reverseString-BixeGz.js → upperFirst-DbrFSz.js} +19 -45
  7. package/dist/_chunk/{zip-BJSrRi.js → zip-DDfXXG.js} +0 -24
  8. package/dist/array/index.js +25 -4
  9. package/dist/browser.global.js +1 -1
  10. package/dist/browser.global.js.map +1 -1
  11. package/dist/compat/_internal/compareValues.mjs +0 -3
  12. package/dist/compat/array/sampleSize.d.mts +38 -0
  13. package/dist/compat/array/sampleSize.d.ts +38 -0
  14. package/dist/compat/array/sampleSize.mjs +18 -0
  15. package/dist/compat/array/unzipWith.d.mts +78 -0
  16. package/dist/compat/array/unzipWith.d.ts +78 -0
  17. package/dist/compat/array/unzipWith.mjs +21 -0
  18. package/dist/compat/array/xor.d.mts +23 -0
  19. package/dist/compat/array/xor.d.ts +23 -0
  20. package/dist/compat/array/xor.mjs +30 -0
  21. package/dist/compat/compat.d.mts +6 -4
  22. package/dist/compat/compat.d.ts +6 -4
  23. package/dist/compat/compat.mjs +7 -5
  24. package/dist/compat/index.d.mts +6 -4
  25. package/dist/compat/index.d.ts +6 -4
  26. package/dist/compat/index.js +4678 -309
  27. package/dist/compat/index.mjs +7 -5
  28. package/dist/compat/object/omitBy.d.mts +22 -0
  29. package/dist/compat/object/omitBy.d.ts +22 -0
  30. package/dist/compat/object/omitBy.mjs +26 -0
  31. package/dist/compat/object/result.d.mts +33 -0
  32. package/dist/compat/object/result.d.ts +33 -0
  33. package/dist/compat/object/result.mjs +24 -0
  34. package/dist/compat/object/transform.d.mts +59 -0
  35. package/dist/compat/object/transform.d.ts +59 -0
  36. package/dist/compat/object/transform.mjs +30 -0
  37. package/dist/compat/util/toString.mjs +3 -0
  38. package/dist/index.js +71 -69
  39. package/dist/object/index.js +28 -15
  40. package/dist/object/toCamelCaseKeys.mjs +2 -12
  41. package/dist/object/toSnakeCaseKeys.mjs +1 -11
  42. package/dist/predicate/index.js +31 -30
  43. package/dist/string/index.js +23 -22
  44. package/package.json +1 -1
  45. package/dist/_chunk/toSnakeCaseKeys-DZO2eB.js +0 -4901
@@ -0,0 +1,379 @@
1
+ 'use strict';
2
+
3
+ const isPlainObject$1 = require('./isPlainObject-Xaozpc.js');
4
+ const snakeCase = require('./snakeCase-BwvoPi.js');
5
+
6
+ function clone(obj) {
7
+ if (isPlainObject$1.isPrimitive(obj)) {
8
+ return obj;
9
+ }
10
+ if (Array.isArray(obj) ||
11
+ isPlainObject$1.isTypedArray(obj) ||
12
+ obj instanceof ArrayBuffer ||
13
+ (typeof SharedArrayBuffer !== 'undefined' && obj instanceof SharedArrayBuffer)) {
14
+ return obj.slice(0);
15
+ }
16
+ const prototype = Object.getPrototypeOf(obj);
17
+ const Constructor = prototype.constructor;
18
+ if (obj instanceof Date || obj instanceof Map || obj instanceof Set) {
19
+ return new Constructor(obj);
20
+ }
21
+ if (obj instanceof RegExp) {
22
+ const newRegExp = new Constructor(obj);
23
+ newRegExp.lastIndex = obj.lastIndex;
24
+ return newRegExp;
25
+ }
26
+ if (obj instanceof DataView) {
27
+ return new Constructor(obj.buffer.slice(0));
28
+ }
29
+ if (obj instanceof Error) {
30
+ const newError = new Constructor(obj.message);
31
+ newError.stack = obj.stack;
32
+ newError.name = obj.name;
33
+ newError.cause = obj.cause;
34
+ return newError;
35
+ }
36
+ if (typeof File !== 'undefined' && obj instanceof File) {
37
+ const newFile = new Constructor([obj], obj.name, { type: obj.type, lastModified: obj.lastModified });
38
+ return newFile;
39
+ }
40
+ if (typeof obj === 'object') {
41
+ const newObject = Object.create(prototype);
42
+ return Object.assign(newObject, obj);
43
+ }
44
+ return obj;
45
+ }
46
+
47
+ function cloneDeepWith(obj, cloneValue) {
48
+ return cloneDeepWithImpl(obj, undefined, obj, new Map(), cloneValue);
49
+ }
50
+ function cloneDeepWithImpl(valueToClone, keyToClone, objectToClone, stack = new Map(), cloneValue = undefined) {
51
+ const cloned = cloneValue?.(valueToClone, keyToClone, objectToClone, stack);
52
+ if (cloned != null) {
53
+ return cloned;
54
+ }
55
+ if (isPlainObject$1.isPrimitive(valueToClone)) {
56
+ return valueToClone;
57
+ }
58
+ if (stack.has(valueToClone)) {
59
+ return stack.get(valueToClone);
60
+ }
61
+ if (Array.isArray(valueToClone)) {
62
+ const result = new Array(valueToClone.length);
63
+ stack.set(valueToClone, result);
64
+ for (let i = 0; i < valueToClone.length; i++) {
65
+ result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
66
+ }
67
+ if (Object.hasOwn(valueToClone, 'index')) {
68
+ result.index = valueToClone.index;
69
+ }
70
+ if (Object.hasOwn(valueToClone, 'input')) {
71
+ result.input = valueToClone.input;
72
+ }
73
+ return result;
74
+ }
75
+ if (valueToClone instanceof Date) {
76
+ return new Date(valueToClone.getTime());
77
+ }
78
+ if (valueToClone instanceof RegExp) {
79
+ const result = new RegExp(valueToClone.source, valueToClone.flags);
80
+ result.lastIndex = valueToClone.lastIndex;
81
+ return result;
82
+ }
83
+ if (valueToClone instanceof Map) {
84
+ const result = new Map();
85
+ stack.set(valueToClone, result);
86
+ for (const [key, value] of valueToClone) {
87
+ result.set(key, cloneDeepWithImpl(value, key, objectToClone, stack, cloneValue));
88
+ }
89
+ return result;
90
+ }
91
+ if (valueToClone instanceof Set) {
92
+ const result = new Set();
93
+ stack.set(valueToClone, result);
94
+ for (const value of valueToClone) {
95
+ result.add(cloneDeepWithImpl(value, undefined, objectToClone, stack, cloneValue));
96
+ }
97
+ return result;
98
+ }
99
+ if (typeof Buffer !== 'undefined' && Buffer.isBuffer(valueToClone)) {
100
+ return valueToClone.subarray();
101
+ }
102
+ if (isPlainObject$1.isTypedArray(valueToClone)) {
103
+ const result = new (Object.getPrototypeOf(valueToClone).constructor)(valueToClone.length);
104
+ stack.set(valueToClone, result);
105
+ for (let i = 0; i < valueToClone.length; i++) {
106
+ result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
107
+ }
108
+ return result;
109
+ }
110
+ if (valueToClone instanceof ArrayBuffer ||
111
+ (typeof SharedArrayBuffer !== 'undefined' && valueToClone instanceof SharedArrayBuffer)) {
112
+ return valueToClone.slice(0);
113
+ }
114
+ if (valueToClone instanceof DataView) {
115
+ const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength);
116
+ stack.set(valueToClone, result);
117
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
118
+ return result;
119
+ }
120
+ if (typeof File !== 'undefined' && valueToClone instanceof File) {
121
+ const result = new File([valueToClone], valueToClone.name, {
122
+ type: valueToClone.type,
123
+ });
124
+ stack.set(valueToClone, result);
125
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
126
+ return result;
127
+ }
128
+ if (valueToClone instanceof Blob) {
129
+ const result = new Blob([valueToClone], { type: valueToClone.type });
130
+ stack.set(valueToClone, result);
131
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
132
+ return result;
133
+ }
134
+ if (valueToClone instanceof Error) {
135
+ const result = new valueToClone.constructor();
136
+ stack.set(valueToClone, result);
137
+ result.message = valueToClone.message;
138
+ result.name = valueToClone.name;
139
+ result.stack = valueToClone.stack;
140
+ result.cause = valueToClone.cause;
141
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
142
+ return result;
143
+ }
144
+ if (typeof valueToClone === 'object' && isCloneableObject(valueToClone)) {
145
+ const result = Object.create(Object.getPrototypeOf(valueToClone));
146
+ stack.set(valueToClone, result);
147
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
148
+ return result;
149
+ }
150
+ return valueToClone;
151
+ }
152
+ function copyProperties(target, source, objectToClone = target, stack, cloneValue) {
153
+ const keys = [...Object.keys(source), ...isPlainObject$1.getSymbols(source)];
154
+ for (let i = 0; i < keys.length; i++) {
155
+ const key = keys[i];
156
+ const descriptor = Object.getOwnPropertyDescriptor(target, key);
157
+ if (descriptor == null || descriptor.writable) {
158
+ target[key] = cloneDeepWithImpl(source[key], key, objectToClone, stack, cloneValue);
159
+ }
160
+ }
161
+ }
162
+ function isCloneableObject(object) {
163
+ switch (isPlainObject$1.getTag(object)) {
164
+ case isPlainObject$1.argumentsTag:
165
+ case isPlainObject$1.arrayTag:
166
+ case isPlainObject$1.arrayBufferTag:
167
+ case isPlainObject$1.dataViewTag:
168
+ case isPlainObject$1.booleanTag:
169
+ case isPlainObject$1.dateTag:
170
+ case isPlainObject$1.float32ArrayTag:
171
+ case isPlainObject$1.float64ArrayTag:
172
+ case isPlainObject$1.int8ArrayTag:
173
+ case isPlainObject$1.int16ArrayTag:
174
+ case isPlainObject$1.int32ArrayTag:
175
+ case isPlainObject$1.mapTag:
176
+ case isPlainObject$1.numberTag:
177
+ case isPlainObject$1.objectTag:
178
+ case isPlainObject$1.regexpTag:
179
+ case isPlainObject$1.setTag:
180
+ case isPlainObject$1.stringTag:
181
+ case isPlainObject$1.symbolTag:
182
+ case isPlainObject$1.uint8ArrayTag:
183
+ case isPlainObject$1.uint8ClampedArrayTag:
184
+ case isPlainObject$1.uint16ArrayTag:
185
+ case isPlainObject$1.uint32ArrayTag: {
186
+ return true;
187
+ }
188
+ default: {
189
+ return false;
190
+ }
191
+ }
192
+ }
193
+
194
+ function cloneDeep(obj) {
195
+ return cloneDeepWithImpl(obj, undefined, obj, new Map(), undefined);
196
+ }
197
+
198
+ function findKey(obj, predicate) {
199
+ const keys = Object.keys(obj);
200
+ return keys.find(key => predicate(obj[key], key, obj));
201
+ }
202
+
203
+ function flattenObject(object, { delimiter = '.' } = {}) {
204
+ return flattenObjectImpl(object, '', delimiter);
205
+ }
206
+ function flattenObjectImpl(object, prefix = '', delimiter = '.') {
207
+ const result = {};
208
+ const keys = Object.keys(object);
209
+ for (let i = 0; i < keys.length; i++) {
210
+ const key = keys[i];
211
+ const value = object[key];
212
+ const prefixedKey = prefix ? `${prefix}${delimiter}${key}` : key;
213
+ if (isPlainObject$1.isPlainObject(value) && Object.keys(value).length > 0) {
214
+ Object.assign(result, flattenObjectImpl(value, prefixedKey, delimiter));
215
+ continue;
216
+ }
217
+ if (Array.isArray(value)) {
218
+ Object.assign(result, flattenObjectImpl(value, prefixedKey, delimiter));
219
+ continue;
220
+ }
221
+ result[prefixedKey] = value;
222
+ }
223
+ return result;
224
+ }
225
+
226
+ function invert(obj) {
227
+ const result = {};
228
+ const keys = Object.keys(obj);
229
+ for (let i = 0; i < keys.length; i++) {
230
+ const key = keys[i];
231
+ const value = obj[key];
232
+ result[value] = key;
233
+ }
234
+ return result;
235
+ }
236
+
237
+ function mapKeys(object, getNewKey) {
238
+ const result = {};
239
+ const keys = Object.keys(object);
240
+ for (let i = 0; i < keys.length; i++) {
241
+ const key = keys[i];
242
+ const value = object[key];
243
+ result[getNewKey(value, key, object)] = value;
244
+ }
245
+ return result;
246
+ }
247
+
248
+ function mapValues(object, getNewValue) {
249
+ const result = {};
250
+ const keys = Object.keys(object);
251
+ for (let i = 0; i < keys.length; i++) {
252
+ const key = keys[i];
253
+ const value = object[key];
254
+ result[key] = getNewValue(value, key, object);
255
+ }
256
+ return result;
257
+ }
258
+
259
+ function merge(target, source) {
260
+ const sourceKeys = Object.keys(source);
261
+ for (let i = 0; i < sourceKeys.length; i++) {
262
+ const key = sourceKeys[i];
263
+ const sourceValue = source[key];
264
+ const targetValue = target[key];
265
+ if (Array.isArray(sourceValue)) {
266
+ if (Array.isArray(targetValue)) {
267
+ target[key] = merge(targetValue, sourceValue);
268
+ }
269
+ else {
270
+ target[key] = merge([], sourceValue);
271
+ }
272
+ }
273
+ else if (isPlainObject$1.isPlainObject(sourceValue)) {
274
+ if (isPlainObject$1.isPlainObject(targetValue)) {
275
+ target[key] = merge(targetValue, sourceValue);
276
+ }
277
+ else {
278
+ target[key] = merge({}, sourceValue);
279
+ }
280
+ }
281
+ else if (targetValue === undefined || sourceValue !== undefined) {
282
+ target[key] = sourceValue;
283
+ }
284
+ }
285
+ return target;
286
+ }
287
+
288
+ function isObjectLike(value) {
289
+ return typeof value === 'object' && value !== null;
290
+ }
291
+
292
+ function isArray(value) {
293
+ return Array.isArray(value);
294
+ }
295
+
296
+ function toCamelCaseKeys(obj) {
297
+ if (isArray(obj)) {
298
+ return obj.map(item => toCamelCaseKeys(item));
299
+ }
300
+ if (isPlainObject$1.isPlainObject(obj)) {
301
+ const result = {};
302
+ const keys = Object.keys(obj);
303
+ for (let i = 0; i < keys.length; i++) {
304
+ const key = keys[i];
305
+ const camelKey = snakeCase.camelCase(key);
306
+ const camelCaseKeys = toCamelCaseKeys(obj[key]);
307
+ result[camelKey] = camelCaseKeys;
308
+ }
309
+ return result;
310
+ }
311
+ return obj;
312
+ }
313
+
314
+ function toMerged(target, source) {
315
+ return merge(cloneDeep(target), source);
316
+ }
317
+
318
+ function isPlainObject(object) {
319
+ if (typeof object !== 'object') {
320
+ return false;
321
+ }
322
+ if (object == null) {
323
+ return false;
324
+ }
325
+ if (Object.getPrototypeOf(object) === null) {
326
+ return true;
327
+ }
328
+ if (Object.prototype.toString.call(object) !== '[object Object]') {
329
+ const tag = object[Symbol.toStringTag];
330
+ if (tag == null) {
331
+ return false;
332
+ }
333
+ const isTagReadonly = !Object.getOwnPropertyDescriptor(object, Symbol.toStringTag)?.writable;
334
+ if (isTagReadonly) {
335
+ return false;
336
+ }
337
+ return object.toString() === `[object ${tag}]`;
338
+ }
339
+ let proto = object;
340
+ while (Object.getPrototypeOf(proto) !== null) {
341
+ proto = Object.getPrototypeOf(proto);
342
+ }
343
+ return Object.getPrototypeOf(object) === proto;
344
+ }
345
+
346
+ function toSnakeCaseKeys(obj) {
347
+ if (isArray(obj)) {
348
+ return obj.map(item => toSnakeCaseKeys(item));
349
+ }
350
+ if (isPlainObject(obj)) {
351
+ const result = {};
352
+ const keys = Object.keys(obj);
353
+ for (let i = 0; i < keys.length; i++) {
354
+ const key = keys[i];
355
+ const snakeKey = snakeCase.snakeCase(key);
356
+ const snakeCaseKeys = toSnakeCaseKeys(obj[key]);
357
+ result[snakeKey] = snakeCaseKeys;
358
+ }
359
+ return result;
360
+ }
361
+ return obj;
362
+ }
363
+
364
+ exports.clone = clone;
365
+ exports.cloneDeep = cloneDeep;
366
+ exports.cloneDeepWith = cloneDeepWith;
367
+ exports.copyProperties = copyProperties;
368
+ exports.findKey = findKey;
369
+ exports.flattenObject = flattenObject;
370
+ exports.invert = invert;
371
+ exports.isArray = isArray;
372
+ exports.isObjectLike = isObjectLike;
373
+ exports.isPlainObject = isPlainObject;
374
+ exports.mapKeys = mapKeys;
375
+ exports.mapValues = mapValues;
376
+ exports.merge = merge;
377
+ exports.toCamelCaseKeys = toCamelCaseKeys;
378
+ exports.toMerged = toMerged;
379
+ exports.toSnakeCaseKeys = toSnakeCaseKeys;
@@ -1,21 +1,10 @@
1
1
  'use strict';
2
2
 
3
- function capitalize(str) {
4
- return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
5
- }
6
-
7
- const CASE_SPLIT_PATTERN = /\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
8
- function words(str) {
9
- return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
10
- }
3
+ const snakeCase = require('./snakeCase-BwvoPi.js');
11
4
 
12
- function camelCase(str) {
13
- const words$1 = words(str);
14
- if (words$1.length === 0) {
15
- return '';
16
- }
17
- const [first, ...rest] = words$1;
18
- return `${first.toLowerCase()}${rest.map(word => capitalize(word)).join('')}`;
5
+ function constantCase(str) {
6
+ const words = snakeCase.words(str);
7
+ return words.map(word => word.toUpperCase()).join('_');
19
8
  }
20
9
 
21
10
  const deburrMap = new Map(Object.entries({
@@ -78,13 +67,13 @@ function escapeRegExp(str) {
78
67
  }
79
68
 
80
69
  function kebabCase(str) {
81
- const words$1 = words(str);
82
- return words$1.map(word => word.toLowerCase()).join('-');
70
+ const words = snakeCase.words(str);
71
+ return words.map(word => word.toLowerCase()).join('-');
83
72
  }
84
73
 
85
74
  function lowerCase(str) {
86
- const words$1 = words(str);
87
- return words$1.map(word => word.toLowerCase()).join(' ');
75
+ const words = snakeCase.words(str);
76
+ return words.map(word => word.toLowerCase()).join(' ');
88
77
  }
89
78
 
90
79
  function lowerFirst(str) {
@@ -95,9 +84,13 @@ function pad(str, length, chars = ' ') {
95
84
  return str.padStart(Math.floor((length - str.length) / 2) + str.length, chars).padEnd(length, chars);
96
85
  }
97
86
 
98
- function snakeCase(str) {
99
- const words$1 = words(str);
100
- return words$1.map(word => word.toLowerCase()).join('_');
87
+ function pascalCase(str) {
88
+ const words = snakeCase.words(str);
89
+ return words.map(word => snakeCase.capitalize(word)).join('');
90
+ }
91
+
92
+ function reverseString(value) {
93
+ return [...value].reverse().join('');
101
94
  }
102
95
 
103
96
  function trimEnd(str, chars) {
@@ -164,11 +157,11 @@ function unescape(str) {
164
157
  }
165
158
 
166
159
  function upperCase(str) {
167
- const words$1 = words(str);
160
+ const words = snakeCase.words(str);
168
161
  let result = '';
169
- for (let i = 0; i < words$1.length; i++) {
170
- result += words$1[i].toUpperCase();
171
- if (i < words$1.length - 1) {
162
+ for (let i = 0; i < words.length; i++) {
163
+ result += words[i].toUpperCase();
164
+ if (i < words.length - 1) {
172
165
  result += ' ';
173
166
  }
174
167
  }
@@ -179,23 +172,6 @@ function upperFirst(str) {
179
172
  return str.substring(0, 1).toUpperCase() + str.substring(1);
180
173
  }
181
174
 
182
- function constantCase(str) {
183
- const words$1 = words(str);
184
- return words$1.map(word => word.toUpperCase()).join('_');
185
- }
186
-
187
- function pascalCase(str) {
188
- const words$1 = words(str);
189
- return words$1.map(word => capitalize(word)).join('');
190
- }
191
-
192
- function reverseString(value) {
193
- return [...value].reverse().join('');
194
- }
195
-
196
- exports.CASE_SPLIT_PATTERN = CASE_SPLIT_PATTERN;
197
- exports.camelCase = camelCase;
198
- exports.capitalize = capitalize;
199
175
  exports.constantCase = constantCase;
200
176
  exports.deburr = deburr;
201
177
  exports.escape = escape;
@@ -206,11 +182,9 @@ exports.lowerFirst = lowerFirst;
206
182
  exports.pad = pad;
207
183
  exports.pascalCase = pascalCase;
208
184
  exports.reverseString = reverseString;
209
- exports.snakeCase = snakeCase;
210
185
  exports.trim = trim;
211
186
  exports.trimEnd = trimEnd;
212
187
  exports.trimStart = trimStart;
213
188
  exports.unescape = unescape;
214
189
  exports.upperCase = upperCase;
215
190
  exports.upperFirst = upperFirst;
216
- exports.words = words;
@@ -342,10 +342,6 @@ function uniq(arr) {
342
342
  return Array.from(new Set(arr));
343
343
  }
344
344
 
345
- function union(arr1, arr2) {
346
- return uniq(arr1.concat(arr2));
347
- }
348
-
349
345
  function uniqBy(arr, mapper) {
350
346
  const map = new Map();
351
347
  for (let i = 0; i < arr.length; i++) {
@@ -395,19 +391,6 @@ function unzip(zipped) {
395
391
  return result;
396
392
  }
397
393
 
398
- function unzipWith(target, iteratee) {
399
- const maxLength = Math.max(...target.map(innerArray => innerArray.length));
400
- const result = new Array(maxLength);
401
- for (let i = 0; i < maxLength; i++) {
402
- const group = new Array(target.length);
403
- for (let j = 0; j < target.length; j++) {
404
- group[j] = target[j][i];
405
- }
406
- result[i] = iteratee(...group);
407
- }
408
- return result;
409
- }
410
-
411
394
  function windowed(arr, size, step = 1, { partialWindows = false } = {}) {
412
395
  if (size <= 0 || !Number.isInteger(size)) {
413
396
  throw new Error('Size must be a positive integer.');
@@ -427,10 +410,6 @@ function without(array, ...values) {
427
410
  return difference(array, values);
428
411
  }
429
412
 
430
- function xor(arr1, arr2) {
431
- return difference(union(arr1, arr2), intersection(arr1, arr2));
432
- }
433
-
434
413
  function xorBy(arr1, arr2, mapper) {
435
414
  const union = unionBy(arr1, arr2, mapper);
436
415
  const intersection = intersectionBy(arr1, arr2, mapper);
@@ -501,17 +480,14 @@ exports.toFilled = toFilled;
501
480
  exports.toFinite = toFinite;
502
481
  exports.toInteger = toInteger;
503
482
  exports.toNumber = toNumber;
504
- exports.union = union;
505
483
  exports.unionBy = unionBy;
506
484
  exports.unionWith = unionWith;
507
485
  exports.uniq = uniq;
508
486
  exports.uniqBy = uniqBy;
509
487
  exports.uniqWith = uniqWith;
510
488
  exports.unzip = unzip;
511
- exports.unzipWith = unzipWith;
512
489
  exports.windowed = windowed;
513
490
  exports.without = without;
514
- exports.xor = xor;
515
491
  exports.xorBy = xorBy;
516
492
  exports.xorWith = xorWith;
517
493
  exports.zip = zip;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const zip = require('../_chunk/zip-BJSrRi.js');
5
+ const zip = require('../_chunk/zip-DDfXXG.js');
6
6
 
7
7
  function at(arr, indices) {
8
8
  const result = new Array(indices.length);
@@ -106,6 +106,27 @@ function takeWhile(arr, shouldContinueTaking) {
106
106
  return result;
107
107
  }
108
108
 
109
+ function union(arr1, arr2) {
110
+ return zip.uniq(arr1.concat(arr2));
111
+ }
112
+
113
+ function unzipWith(target, iteratee) {
114
+ const maxLength = Math.max(...target.map(innerArray => innerArray.length));
115
+ const result = new Array(maxLength);
116
+ for (let i = 0; i < maxLength; i++) {
117
+ const group = new Array(target.length);
118
+ for (let j = 0; j < target.length; j++) {
119
+ group[j] = target[j][i];
120
+ }
121
+ result[i] = iteratee(...group);
122
+ }
123
+ return result;
124
+ }
125
+
126
+ function xor(arr1, arr2) {
127
+ return zip.difference(union(arr1, arr2), zip.intersection(arr1, arr2));
128
+ }
129
+
109
130
  function zipObject(keys, values) {
110
131
  const result = {};
111
132
  for (let i = 0; i < keys.length; i++) {
@@ -161,17 +182,14 @@ exports.tail = zip.tail;
161
182
  exports.take = zip.take;
162
183
  exports.takeRight = zip.takeRight;
163
184
  exports.toFilled = zip.toFilled;
164
- exports.union = zip.union;
165
185
  exports.unionBy = zip.unionBy;
166
186
  exports.unionWith = zip.unionWith;
167
187
  exports.uniq = zip.uniq;
168
188
  exports.uniqBy = zip.uniqBy;
169
189
  exports.uniqWith = zip.uniqWith;
170
190
  exports.unzip = zip.unzip;
171
- exports.unzipWith = zip.unzipWith;
172
191
  exports.windowed = zip.windowed;
173
192
  exports.without = zip.without;
174
- exports.xor = zip.xor;
175
193
  exports.xorBy = zip.xorBy;
176
194
  exports.xorWith = zip.xorWith;
177
195
  exports.zip = zip.zip;
@@ -184,5 +202,8 @@ exports.pullAt = pullAt;
184
202
  exports.sortBy = sortBy;
185
203
  exports.takeRightWhile = takeRightWhile;
186
204
  exports.takeWhile = takeWhile;
205
+ exports.union = union;
206
+ exports.unzipWith = unzipWith;
207
+ exports.xor = xor;
187
208
  exports.zipObject = zipObject;
188
209
  exports.zipWith = zipWith;