es-toolkit 1.22.0 → 1.23.0-dev.717

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 (86) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/_chunk/{flowRight-BzdOZX.js → flowRight-Dv8J0U.js} +21 -3
  3. package/dist/_chunk/{toMerged-2WPeoI.js → isObjectLike-aywuSF.js} +20 -10
  4. package/dist/_chunk/{isPlainObject-BIekvL.js → isPlainObject-DgrsU7.js} +11 -11
  5. package/dist/_chunk/{isWeakSet-clQklw.js → isWeakSet-BAMm2l.js} +85 -22
  6. package/dist/_chunk/noop-2IwLUk.js +5 -0
  7. package/dist/_chunk/{pad-Cw2pvt.js → pad-BWiShN.js} +21 -21
  8. package/dist/browser.global.js +1 -1
  9. package/dist/browser.global.js.map +1 -1
  10. package/dist/compat/array/dropWhile.d.mts +20 -0
  11. package/dist/compat/array/dropWhile.d.ts +20 -0
  12. package/dist/compat/array/every.d.mts +11 -11
  13. package/dist/compat/array/every.d.ts +11 -11
  14. package/dist/compat/array/filter.d.mts +10 -11
  15. package/dist/compat/array/filter.d.ts +10 -11
  16. package/dist/compat/array/filter.mjs +13 -0
  17. package/dist/compat/array/includes.mjs +1 -4
  18. package/dist/compat/function/flow.d.mts +133 -0
  19. package/dist/compat/function/flow.d.ts +133 -0
  20. package/dist/compat/function/flow.mjs +12 -0
  21. package/dist/compat/function/flowRight.d.mts +145 -0
  22. package/dist/compat/function/flowRight.d.ts +145 -0
  23. package/dist/compat/function/flowRight.mjs +12 -0
  24. package/dist/compat/index.d.mts +9 -2
  25. package/dist/compat/index.d.ts +9 -2
  26. package/dist/compat/index.js +109 -49
  27. package/dist/compat/index.mjs +10 -3
  28. package/dist/compat/math/random.mjs +1 -1
  29. package/dist/compat/object/has.mjs +2 -2
  30. package/dist/compat/object/invertBy.d.mts +27 -0
  31. package/dist/compat/object/invertBy.d.ts +27 -0
  32. package/dist/compat/object/invertBy.mjs +27 -0
  33. package/dist/compat/object/mapKeys.mjs +1 -1
  34. package/dist/compat/object/mapValues.mjs +1 -1
  35. package/dist/compat/object/merge.mjs +1 -1
  36. package/dist/compat/object/mergeWith.mjs +1 -1
  37. package/dist/compat/object/omit.mjs +1 -1
  38. package/dist/compat/object/pick.mjs +2 -2
  39. package/dist/compat/object/unset.mjs +1 -1
  40. package/dist/compat/predicate/isMatch.mjs +4 -0
  41. package/dist/compat/predicate/matches.mjs +1 -1
  42. package/dist/compat/predicate/matchesProperty.mjs +1 -1
  43. package/dist/function/curryRight.d.mts +140 -0
  44. package/dist/function/curryRight.d.ts +140 -0
  45. package/dist/function/curryRight.mjs +21 -0
  46. package/dist/function/index.d.mts +1 -0
  47. package/dist/function/index.d.ts +1 -0
  48. package/dist/function/index.js +4 -2
  49. package/dist/function/index.mjs +1 -0
  50. package/dist/index.d.mts +6 -0
  51. package/dist/index.d.ts +6 -0
  52. package/dist/index.js +23 -16
  53. package/dist/index.mjs +6 -0
  54. package/dist/object/clone.mjs +1 -1
  55. package/dist/object/cloneDeep.mjs +2 -2
  56. package/dist/object/index.js +13 -13
  57. package/dist/object/merge.mjs +14 -4
  58. package/dist/object/pick.mjs +1 -1
  59. package/dist/predicate/index.d.mts +5 -0
  60. package/dist/predicate/index.d.ts +5 -0
  61. package/dist/predicate/index.js +7 -2
  62. package/dist/predicate/index.mjs +5 -0
  63. package/dist/predicate/isArrayBuffer.d.mts +20 -0
  64. package/dist/predicate/isArrayBuffer.d.ts +20 -0
  65. package/dist/predicate/isArrayBuffer.mjs +5 -0
  66. package/dist/predicate/isEqual.mjs +3 -171
  67. package/dist/predicate/isEqualWith.d.mts +38 -0
  68. package/dist/predicate/isEqualWith.d.ts +38 -0
  69. package/dist/predicate/isEqualWith.mjs +184 -0
  70. package/dist/predicate/isJSONArray.d.mts +17 -0
  71. package/dist/predicate/isJSONArray.d.ts +17 -0
  72. package/dist/predicate/isJSONArray.mjs +10 -0
  73. package/dist/predicate/isJSONObject.d.mts +16 -0
  74. package/dist/predicate/isJSONObject.d.ts +16 -0
  75. package/dist/predicate/isJSONObject.mjs +22 -0
  76. package/dist/predicate/isJSONValue.d.mts +27 -0
  77. package/dist/predicate/isJSONValue.d.ts +27 -0
  78. package/dist/predicate/isJSONValue.mjs +20 -0
  79. package/dist/predicate/isPlainObject.d.mts +3 -3
  80. package/dist/predicate/isPlainObject.d.ts +3 -3
  81. package/dist/predicate/isPlainObject.mjs +7 -7
  82. package/dist/string/_internal/getWords.mjs +1 -1
  83. package/dist/string/camelCase.mjs +1 -1
  84. package/dist/string/index.js +1 -1
  85. package/dist/string/trim.mjs +1 -1
  86. package/package.json +11 -3
@@ -4,13 +4,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const zipWith = require('../_chunk/zipWith-EOU_KZ.js');
6
6
  const promise_index = require('../_chunk/index-BGZDR9.js');
7
- const flowRight = require('../_chunk/flowRight-BzdOZX.js');
7
+ const flowRight$1 = require('../_chunk/flowRight-Dv8J0U.js');
8
+ const noop = require('../_chunk/noop-2IwLUk.js');
8
9
  const range = require('../_chunk/range-BXlMmn.js');
9
10
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
10
- const toMerged = require('../_chunk/toMerged-2WPeoI.js');
11
- const isPlainObject$1 = require('../_chunk/isPlainObject-BIekvL.js');
12
- const isWeakSet$1 = require('../_chunk/isWeakSet-clQklw.js');
13
- const pad$1 = require('../_chunk/pad-Cw2pvt.js');
11
+ const isObjectLike = require('../_chunk/isObjectLike-aywuSF.js');
12
+ const isPlainObject$1 = require('../_chunk/isPlainObject-DgrsU7.js');
13
+ const isWeakSet$1 = require('../_chunk/isWeakSet-BAMm2l.js');
14
+ const pad$1 = require('../_chunk/pad-BWiShN.js');
14
15
 
15
16
  function castArray(value) {
16
17
  if (arguments.length === 0) {
@@ -169,6 +170,10 @@ function property(path) {
169
170
  };
170
171
  }
171
172
 
173
+ function isObject(value) {
174
+ return value !== null && (typeof value === 'object' || typeof value === 'function');
175
+ }
176
+
172
177
  function isMatch(target, source) {
173
178
  if (source === target) {
174
179
  return true;
@@ -215,6 +220,9 @@ function isMatch(target, source) {
215
220
  return false;
216
221
  }
217
222
  default: {
223
+ if (!isObject(target)) {
224
+ return target === source || (Number.isNaN(target) && Number.isNaN(source));
225
+ }
218
226
  return !source;
219
227
  }
220
228
  }
@@ -264,7 +272,7 @@ function isSetMatch(target, source) {
264
272
  }
265
273
 
266
274
  function matches(source) {
267
- source = toMerged.cloneDeep(source);
275
+ source = isObjectLike.cloneDeep(source);
268
276
  return (target) => {
269
277
  return isMatch(target, source);
270
278
  };
@@ -272,25 +280,25 @@ function matches(source) {
272
280
 
273
281
  function cloneDeep(obj) {
274
282
  if (typeof obj !== 'object') {
275
- return toMerged.cloneDeep(obj);
283
+ return isObjectLike.cloneDeep(obj);
276
284
  }
277
285
  switch (Object.prototype.toString.call(obj)) {
278
286
  case isWeakSet$1.numberTag:
279
287
  case isWeakSet$1.stringTag:
280
288
  case isWeakSet$1.booleanTag: {
281
289
  const result = new obj.constructor(obj?.valueOf());
282
- toMerged.copyProperties(result, obj);
290
+ isObjectLike.copyProperties(result, obj);
283
291
  return result;
284
292
  }
285
293
  case isWeakSet$1.argumentsTag: {
286
294
  const result = {};
287
- toMerged.copyProperties(result, obj);
295
+ isObjectLike.copyProperties(result, obj);
288
296
  result.length = obj.length;
289
297
  result[Symbol.iterator] = obj[Symbol.iterator];
290
298
  return result;
291
299
  }
292
300
  default: {
293
- return toMerged.cloneDeep(obj);
301
+ return isObjectLike.cloneDeep(obj);
294
302
  }
295
303
  }
296
304
  }
@@ -331,7 +339,7 @@ function has(object, path) {
331
339
  let current = object;
332
340
  for (let i = 0; i < resolvedPath.length; i++) {
333
341
  const key = resolvedPath[i];
334
- if (current == null || !Object.prototype.hasOwnProperty.call(current, key)) {
342
+ if (current == null || !Object.hasOwn(current, key)) {
335
343
  const isSparseIndex = (Array.isArray(current) || isArguments(current)) && isIndex(key) && key < current.length;
336
344
  if (!isSparseIndex) {
337
345
  return false;
@@ -626,10 +634,7 @@ function includes(source, target, fromIndex, guard) {
626
634
  if (Array.isArray(source)) {
627
635
  return source.includes(target, fromIndex);
628
636
  }
629
- const keys = [];
630
- for (const key in source) {
631
- keys.push(key);
632
- }
637
+ const keys = Object.keys(source);
633
638
  if (fromIndex < 0) {
634
639
  fromIndex = Math.max(0, keys.length + fromIndex);
635
640
  }
@@ -865,6 +870,19 @@ function filter(source, predicate) {
865
870
  const collection = isArray(source) ? source : Object.values(source);
866
871
  switch (typeof predicate) {
867
872
  case 'function': {
873
+ if (!Array.isArray(source)) {
874
+ const result = [];
875
+ const entries = Object.entries(source);
876
+ for (let i = 0; i < entries.length; i++) {
877
+ const entry = entries[i];
878
+ const key = entry[0];
879
+ const value = entry[1];
880
+ if (predicate(value, key, source)) {
881
+ result.push(value);
882
+ }
883
+ }
884
+ return result;
885
+ }
868
886
  return collection.filter(predicate);
869
887
  }
870
888
  case 'object': {
@@ -885,7 +903,7 @@ function ary(func, n = func.length, guard) {
885
903
  if (Number.isNaN(n) || n < 0) {
886
904
  n = 0;
887
905
  }
888
- return flowRight.ary(func, n);
906
+ return flowRight$1.ary(func, n);
889
907
  }
890
908
 
891
909
  function bind(func, thisObj, ...partialArgs) {
@@ -952,7 +970,7 @@ function rest(func, start = func.length - 1) {
952
970
  if (Number.isNaN(start) || start < 0) {
953
971
  start = func.length - 1;
954
972
  }
955
- return flowRight.rest(func, start);
973
+ return flowRight$1.rest(func, start);
956
974
  }
957
975
 
958
976
  function spread(func, argsIndex = 0) {
@@ -1060,7 +1078,7 @@ function debounce(func, debounceMs = 0, options = {}) {
1060
1078
  }
1061
1079
  let result = undefined;
1062
1080
  let pendingAt = null;
1063
- const _debounced = flowRight.debounce(function (...args) {
1081
+ const _debounced = flowRight$1.debounce(function (...args) {
1064
1082
  result = func.apply(this, args);
1065
1083
  pendingAt = null;
1066
1084
  }, debounceMs, { signal, edges });
@@ -1105,6 +1123,22 @@ function flip(func) {
1105
1123
  };
1106
1124
  }
1107
1125
 
1126
+ function flow(...funcs) {
1127
+ const flattenFuncs = zipWith.flatten(funcs, 1);
1128
+ if (flattenFuncs.some(func => typeof func !== 'function')) {
1129
+ throw new TypeError('Expected a function');
1130
+ }
1131
+ return flowRight$1.flow(...flattenFuncs);
1132
+ }
1133
+
1134
+ function flowRight(...funcs) {
1135
+ const flattenFuncs = zipWith.flatten(funcs, 1);
1136
+ if (flattenFuncs.some(func => typeof func !== 'function')) {
1137
+ throw new TypeError('Expected a function');
1138
+ }
1139
+ return flowRight$1.flowRight(...flattenFuncs);
1140
+ }
1141
+
1108
1142
  function isNil(x) {
1109
1143
  return x == null;
1110
1144
  }
@@ -1132,7 +1166,7 @@ function pick(obj, ...keysArr) {
1132
1166
  }
1133
1167
  for (const key of keys) {
1134
1168
  const value = get(obj, key);
1135
- if (typeof key === 'string' && Object.prototype.hasOwnProperty.call(obj, key)) {
1169
+ if (typeof key === 'string' && Object.hasOwn(obj, key)) {
1136
1170
  result[key] = value;
1137
1171
  }
1138
1172
  else {
@@ -1209,7 +1243,7 @@ function omit(obj, ...keysArr) {
1209
1243
  if (obj == null) {
1210
1244
  return {};
1211
1245
  }
1212
- const result = toMerged.cloneDeep(obj);
1246
+ const result = isObjectLike.cloneDeep(obj);
1213
1247
  for (let i = 0; i < keysArr.length; i++) {
1214
1248
  let keys = keysArr[i];
1215
1249
  switch (typeof keys) {
@@ -1241,10 +1275,10 @@ function mapKeys(object, getNewKey) {
1241
1275
  case 'symbol':
1242
1276
  case 'number':
1243
1277
  case 'object': {
1244
- return toMerged.mapKeys(object, property(getNewKey));
1278
+ return isObjectLike.mapKeys(object, property(getNewKey));
1245
1279
  }
1246
1280
  case 'function': {
1247
- return toMerged.mapKeys(object, getNewKey);
1281
+ return isObjectLike.mapKeys(object, getNewKey);
1248
1282
  }
1249
1283
  }
1250
1284
  }
@@ -1256,10 +1290,10 @@ function mapValues(object, getNewValue) {
1256
1290
  case 'symbol':
1257
1291
  case 'number':
1258
1292
  case 'object': {
1259
- return toMerged.mapValues(object, property(getNewValue));
1293
+ return isObjectLike.mapValues(object, property(getNewValue));
1260
1294
  }
1261
1295
  case 'function': {
1262
- return toMerged.mapValues(object, getNewValue);
1296
+ return isObjectLike.mapValues(object, getNewValue);
1263
1297
  }
1264
1298
  }
1265
1299
  }
@@ -1311,7 +1345,7 @@ function mergeWithDeep(target, source, merge, stack) {
1311
1345
  return target;
1312
1346
  }
1313
1347
  if (stack.has(source)) {
1314
- return toMerged.clone(stack.get(source));
1348
+ return isObjectLike.clone(stack.get(source));
1315
1349
  }
1316
1350
  stack.set(source, target);
1317
1351
  if (Array.isArray(source)) {
@@ -1355,7 +1389,7 @@ function mergeWithDeep(target, source, merge, stack) {
1355
1389
  else if (Array.isArray(sourceValue)) {
1356
1390
  target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack);
1357
1391
  }
1358
- else if (toMerged.isObjectLike(targetValue) && toMerged.isObjectLike(sourceValue)) {
1392
+ else if (isObjectLike.isObjectLike(targetValue) && isObjectLike.isObjectLike(sourceValue)) {
1359
1393
  target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack);
1360
1394
  }
1361
1395
  else if (targetValue == null && isPlainObject(sourceValue)) {
@@ -1372,7 +1406,7 @@ function mergeWithDeep(target, source, merge, stack) {
1372
1406
  }
1373
1407
 
1374
1408
  function merge(object, ...sources) {
1375
- return mergeWith(object, ...sources, flowRight.noop);
1409
+ return mergeWith(object, ...sources, noop.noop);
1376
1410
  }
1377
1411
 
1378
1412
  function isArrayLike(value) {
@@ -1390,8 +1424,27 @@ function fromPairs(pairs) {
1390
1424
  return result;
1391
1425
  }
1392
1426
 
1393
- function isObject(value) {
1394
- return value !== null && (typeof value === 'object' || typeof value === 'function');
1427
+ function invertBy(object, iteratee) {
1428
+ const result = {};
1429
+ if (isWeakSet$1.isNil(object)) {
1430
+ return result;
1431
+ }
1432
+ if (iteratee == null) {
1433
+ iteratee = identity;
1434
+ }
1435
+ const keys = Object.keys(object);
1436
+ for (let i = 0; i < keys.length; i++) {
1437
+ const key = keys[i];
1438
+ const value = object[key];
1439
+ const valueStr = iteratee(value);
1440
+ if (Array.isArray(result[valueStr])) {
1441
+ result[valueStr].push(key);
1442
+ }
1443
+ else {
1444
+ result[valueStr] = [key];
1445
+ }
1446
+ }
1447
+ return result;
1395
1448
  }
1396
1449
 
1397
1450
  function isBoolean(value) {
@@ -1438,7 +1491,7 @@ function conformsTo(target, source) {
1438
1491
  }
1439
1492
 
1440
1493
  function conforms(source) {
1441
- source = toMerged.cloneDeep(source);
1494
+ source = isObjectLike.cloneDeep(source);
1442
1495
  return function (object) {
1443
1496
  return conformsTo(object, source);
1444
1497
  };
@@ -1461,7 +1514,7 @@ function isNaN(value) {
1461
1514
  }
1462
1515
 
1463
1516
  function isArrayLikeObject(value) {
1464
- return toMerged.isObjectLike(value) && isArrayLike(value);
1517
+ return isObjectLike.isObjectLike(value) && isArrayLike(value);
1465
1518
  }
1466
1519
 
1467
1520
  function toString(value) {
@@ -1829,34 +1882,38 @@ exports.TimeoutError = promise_index.TimeoutError;
1829
1882
  exports.delay = promise_index.delay;
1830
1883
  exports.timeout = promise_index.timeout;
1831
1884
  exports.withTimeout = promise_index.withTimeout;
1832
- exports.after = flowRight.after;
1833
- exports.before = flowRight.before;
1834
- exports.flow = flowRight.flow;
1835
- exports.flowRight = flowRight.flowRight;
1836
- exports.memoize = flowRight.memoize;
1837
- exports.negate = flowRight.negate;
1838
- exports.noop = flowRight.noop;
1839
- exports.once = flowRight.once;
1840
- exports.partial = flowRight.partial;
1841
- exports.partialRight = flowRight.partialRight;
1842
- exports.unary = flowRight.unary;
1885
+ exports.after = flowRight$1.after;
1886
+ exports.before = flowRight$1.before;
1887
+ exports.curryRight = flowRight$1.curryRight;
1888
+ exports.memoize = flowRight$1.memoize;
1889
+ exports.negate = flowRight$1.negate;
1890
+ exports.once = flowRight$1.once;
1891
+ exports.partial = flowRight$1.partial;
1892
+ exports.partialRight = flowRight$1.partialRight;
1893
+ exports.unary = flowRight$1.unary;
1894
+ exports.noop = noop.noop;
1843
1895
  exports.mean = range.mean;
1844
1896
  exports.meanBy = range.meanBy;
1845
1897
  exports.range = range.range;
1846
1898
  exports.sum = range.sum;
1847
1899
  exports.sumBy = range.sumBy;
1848
1900
  exports.randomInt = randomInt.randomInt;
1849
- exports.clone = toMerged.clone;
1850
- exports.flattenObject = toMerged.flattenObject;
1851
- exports.invert = toMerged.invert;
1852
- exports.isObjectLike = toMerged.isObjectLike;
1853
- exports.omitBy = toMerged.omitBy;
1854
- exports.pickBy = toMerged.pickBy;
1855
- exports.toMerged = toMerged.toMerged;
1901
+ exports.clone = isObjectLike.clone;
1902
+ exports.flattenObject = isObjectLike.flattenObject;
1903
+ exports.invert = isObjectLike.invert;
1904
+ exports.isObjectLike = isObjectLike.isObjectLike;
1905
+ exports.omitBy = isObjectLike.omitBy;
1906
+ exports.pickBy = isObjectLike.pickBy;
1907
+ exports.toMerged = isObjectLike.toMerged;
1856
1908
  exports.isPrimitive = isPlainObject$1.isPrimitive;
1909
+ exports.isArrayBuffer = isWeakSet$1.isArrayBuffer;
1857
1910
  exports.isDate = isWeakSet$1.isDate;
1858
1911
  exports.isEqual = isWeakSet$1.isEqual;
1912
+ exports.isEqualWith = isWeakSet$1.isEqualWith;
1859
1913
  exports.isFunction = isWeakSet$1.isFunction;
1914
+ exports.isJSONArray = isWeakSet$1.isJSONArray;
1915
+ exports.isJSONObject = isWeakSet$1.isJSONObject;
1916
+ exports.isJSONValue = isWeakSet$1.isJSONValue;
1860
1917
  exports.isLength = isWeakSet$1.isLength;
1861
1918
  exports.isMap = isWeakSet$1.isMap;
1862
1919
  exports.isNotNil = isWeakSet$1.isNotNil;
@@ -1903,12 +1960,15 @@ exports.flattenDeep = flattenDeep;
1903
1960
  exports.flattenDepth = flattenDepth;
1904
1961
  exports.flip = flip;
1905
1962
  exports.floor = floor;
1963
+ exports.flow = flow;
1964
+ exports.flowRight = flowRight;
1906
1965
  exports.fromPairs = fromPairs;
1907
1966
  exports.get = get;
1908
1967
  exports.has = has;
1909
1968
  exports.inRange = inRange;
1910
1969
  exports.includes = includes;
1911
1970
  exports.indexOf = indexOf;
1971
+ exports.invertBy = invertBy;
1912
1972
  exports.isArguments = isArguments;
1913
1973
  exports.isArray = isArray;
1914
1974
  exports.isArrayLike = isArrayLike;
@@ -56,8 +56,7 @@ export { memoize } from '../function/memoize.mjs';
56
56
  export { unary } from '../function/unary.mjs';
57
57
  export { partial } from '../function/partial.mjs';
58
58
  export { partialRight } from '../function/partialRight.mjs';
59
- export { flow } from '../function/flow.mjs';
60
- export { flowRight } from '../function/flowRight.mjs';
59
+ export { curryRight } from '../function/curryRight.mjs';
61
60
  export { mean } from '../math/mean.mjs';
62
61
  export { meanBy } from '../math/meanBy.mjs';
63
62
  export { randomInt } from '../math/randomInt.mjs';
@@ -70,16 +69,21 @@ export { invert } from '../object/invert.mjs';
70
69
  export { clone } from '../object/clone.mjs';
71
70
  export { flattenObject } from '../object/flattenObject.mjs';
72
71
  export { isPrimitive } from '../predicate/isPrimitive.mjs';
73
- export { isObjectLike } from './predicate/isObjectLike.mjs';
74
72
  export { toMerged } from '../object/toMerged.mjs';
73
+ export { isObjectLike } from './predicate/isObjectLike.mjs';
74
+ export { isArrayBuffer } from '../predicate/isArrayBuffer.mjs';
75
75
  export { isDate } from '../predicate/isDate.mjs';
76
76
  export { isEqual } from '../predicate/isEqual.mjs';
77
+ export { isEqualWith } from '../predicate/isEqualWith.mjs';
77
78
  export { isMap } from '../predicate/isMap.mjs';
78
79
  export { isNotNil } from '../predicate/isNotNil.mjs';
79
80
  export { isNull } from '../predicate/isNull.mjs';
80
81
  export { isUndefined } from '../predicate/isUndefined.mjs';
81
82
  export { isLength } from '../predicate/isLength.mjs';
82
83
  export { isFunction } from '../predicate/isFunction.mjs';
84
+ export { isJSONObject } from '../predicate/isJSONObject.mjs';
85
+ export { isJSONValue } from '../predicate/isJSONValue.mjs';
86
+ export { isJSONArray } from '../predicate/isJSONArray.mjs';
83
87
  export { isSet } from '../predicate/isSet.mjs';
84
88
  export { delay } from '../promise/delay.mjs';
85
89
  export { withTimeout } from '../promise/withTimeout.mjs';
@@ -128,6 +132,8 @@ export { curry } from './function/curry.mjs';
128
132
  export { debounce } from './function/debounce.mjs';
129
133
  export { throttle } from './function/throttle.mjs';
130
134
  export { flip } from './function/flip.mjs';
135
+ export { flow } from './function/flow.mjs';
136
+ export { flowRight } from './function/flowRight.mjs';
131
137
  export { get } from './object/get.mjs';
132
138
  export { set } from './object/set.mjs';
133
139
  export { pick } from './object/pick.mjs';
@@ -141,6 +147,7 @@ export { mergeWith } from './object/mergeWith.mjs';
141
147
  export { fromPairs } from './object/fromPairs.mjs';
142
148
  export { unset } from './object/unset.mjs';
143
149
  export { cloneDeep } from './object/cloneDeep.mjs';
150
+ export { invertBy } from './object/invertBy.mjs';
144
151
  export { isPlainObject } from './predicate/isPlainObject.mjs';
145
152
  export { isArray } from './predicate/isArray.mjs';
146
153
  export { isArguments } from './predicate/isArguments.mjs';
@@ -1,6 +1,6 @@
1
+ import { clamp } from './clamp.mjs';
1
2
  import { random as random$1 } from '../../math/random.mjs';
2
3
  import { randomInt } from '../../math/randomInt.mjs';
3
- import { clamp } from './clamp.mjs';
4
4
 
5
5
  function random(...args) {
6
6
  let minimum = 0;
@@ -1,7 +1,7 @@
1
1
  import { isDeepKey } from '../_internal/isDeepKey.mjs';
2
2
  import { isIndex } from '../_internal/isIndex.mjs';
3
- import { toPath } from '../util/toPath.mjs';
4
3
  import { isArguments } from '../predicate/isArguments.mjs';
4
+ import { toPath } from '../util/toPath.mjs';
5
5
 
6
6
  function has(object, path) {
7
7
  let resolvedPath;
@@ -20,7 +20,7 @@ function has(object, path) {
20
20
  let current = object;
21
21
  for (let i = 0; i < resolvedPath.length; i++) {
22
22
  const key = resolvedPath[i];
23
- if (current == null || !Object.prototype.hasOwnProperty.call(current, key)) {
23
+ if (current == null || !Object.hasOwn(current, key)) {
24
24
  const isSparseIndex = (Array.isArray(current) || isArguments(current)) && isIndex(key) && key < current.length;
25
25
  if (!isSparseIndex) {
26
26
  return false;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Creates a new object that reverses the keys and values of the given object, similar to the invert.
3
+ *
4
+ * The `iteratee` function specifies how the values are reversed into keys. If no `iteratee` function is provided, the values are used as keys as-is.
5
+ *
6
+ * The values of the new object are arrays of keys that correspond to the value returned by the `iteratee` function.
7
+ *
8
+ * @param {Record<K, V>} object - The object to iterate over.
9
+ * @param {(value: V) => string} [iteratee] - Optional. A function that generates a key based on each value in the object.
10
+ * If not provided, the function defaults to using the value as a string.
11
+ *
12
+ * @returns {Record<string, K[]>} An object where the keys are generated by the iteratee, and the values
13
+ * are arrays of property names (keys) from the input object that correspond to those keys.
14
+ *
15
+ * @example
16
+ * const obj = { a: 1, b: 2, c: 1 };
17
+ * const result = invertBy(obj);
18
+ * // result => { '1': ['a', 'c'], '2': ['b'] }
19
+ *
20
+ * @example
21
+ * const obj = { a: 1, b: 2, c: 1 };
22
+ * const result = invertBy(obj, value => `group${value}`);
23
+ * // result => { 'group1': ['a', 'c'], 'group2': ['b'] }
24
+ */
25
+ declare function invertBy<K extends PropertyKey, V>(object: Record<K, V>, iteratee?: (value: V) => string): Record<string, K[]>;
26
+
27
+ export { invertBy };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Creates a new object that reverses the keys and values of the given object, similar to the invert.
3
+ *
4
+ * The `iteratee` function specifies how the values are reversed into keys. If no `iteratee` function is provided, the values are used as keys as-is.
5
+ *
6
+ * The values of the new object are arrays of keys that correspond to the value returned by the `iteratee` function.
7
+ *
8
+ * @param {Record<K, V>} object - The object to iterate over.
9
+ * @param {(value: V) => string} [iteratee] - Optional. A function that generates a key based on each value in the object.
10
+ * If not provided, the function defaults to using the value as a string.
11
+ *
12
+ * @returns {Record<string, K[]>} An object where the keys are generated by the iteratee, and the values
13
+ * are arrays of property names (keys) from the input object that correspond to those keys.
14
+ *
15
+ * @example
16
+ * const obj = { a: 1, b: 2, c: 1 };
17
+ * const result = invertBy(obj);
18
+ * // result => { '1': ['a', 'c'], '2': ['b'] }
19
+ *
20
+ * @example
21
+ * const obj = { a: 1, b: 2, c: 1 };
22
+ * const result = invertBy(obj, value => `group${value}`);
23
+ * // result => { 'group1': ['a', 'c'], 'group2': ['b'] }
24
+ */
25
+ declare function invertBy<K extends PropertyKey, V>(object: Record<K, V>, iteratee?: (value: V) => string): Record<string, K[]>;
26
+
27
+ export { invertBy };
@@ -0,0 +1,27 @@
1
+ import { isNil } from '../../predicate/isNil.mjs';
2
+ import { identity } from '../_internal/identity.mjs';
3
+
4
+ function invertBy(object, iteratee) {
5
+ const result = {};
6
+ if (isNil(object)) {
7
+ return result;
8
+ }
9
+ if (iteratee == null) {
10
+ iteratee = identity;
11
+ }
12
+ const keys = Object.keys(object);
13
+ for (let i = 0; i < keys.length; i++) {
14
+ const key = keys[i];
15
+ const value = object[key];
16
+ const valueStr = iteratee(value);
17
+ if (Array.isArray(result[valueStr])) {
18
+ result[valueStr].push(key);
19
+ }
20
+ else {
21
+ result[valueStr] = [key];
22
+ }
23
+ }
24
+ return result;
25
+ }
26
+
27
+ export { invertBy };
@@ -1,6 +1,6 @@
1
+ import { property } from './property.mjs';
1
2
  import { mapKeys as mapKeys$1 } from '../../object/mapKeys.mjs';
2
3
  import { identity } from '../_internal/identity.mjs';
3
- import { property } from './property.mjs';
4
4
 
5
5
  function mapKeys(object, getNewKey) {
6
6
  getNewKey = getNewKey ?? identity;
@@ -1,6 +1,6 @@
1
+ import { property } from './property.mjs';
1
2
  import { mapValues as mapValues$1 } from '../../object/mapValues.mjs';
2
3
  import { identity } from '../_internal/identity.mjs';
3
- import { property } from './property.mjs';
4
4
 
5
5
  function mapValues(object, getNewValue) {
6
6
  getNewValue = getNewValue ?? identity;
@@ -1,5 +1,5 @@
1
- import { noop } from '../../function/noop.mjs';
2
1
  import { mergeWith } from './mergeWith.mjs';
2
+ import { noop } from '../../function/noop.mjs';
3
3
 
4
4
  function merge(object, ...sources) {
5
5
  return mergeWith(object, ...sources, noop);
@@ -1,10 +1,10 @@
1
+ import { cloneDeep } from './cloneDeep.mjs';
1
2
  import { clone } from '../../object/clone.mjs';
2
3
  import { getSymbols } from '../_internal/getSymbols.mjs';
3
4
  import { isArguments } from '../predicate/isArguments.mjs';
4
5
  import { isObjectLike } from '../predicate/isObjectLike.mjs';
5
6
  import { isPlainObject } from '../predicate/isPlainObject.mjs';
6
7
  import { isTypedArray } from '../predicate/isTypedArray.mjs';
7
- import { cloneDeep } from './cloneDeep.mjs';
8
8
 
9
9
  function mergeWith(object, ...otherArgs) {
10
10
  const sources = otherArgs.slice(0, -1);
@@ -1,5 +1,5 @@
1
- import { cloneDeep } from '../../object/cloneDeep.mjs';
2
1
  import { unset } from './unset.mjs';
2
+ import { cloneDeep } from '../../object/cloneDeep.mjs';
3
3
 
4
4
  function omit(obj, ...keysArr) {
5
5
  if (obj == null) {
@@ -1,6 +1,6 @@
1
- import { isNil } from '../predicate/isNil.mjs';
2
1
  import { get } from './get.mjs';
3
2
  import { set } from './set.mjs';
3
+ import { isNil } from '../predicate/isNil.mjs';
4
4
 
5
5
  function pick(obj, ...keysArr) {
6
6
  if (isNil(obj)) {
@@ -25,7 +25,7 @@ function pick(obj, ...keysArr) {
25
25
  }
26
26
  for (const key of keys) {
27
27
  const value = get(obj, key);
28
- if (typeof key === 'string' && Object.prototype.hasOwnProperty.call(obj, key)) {
28
+ if (typeof key === 'string' && Object.hasOwn(obj, key)) {
29
29
  result[key] = value;
30
30
  }
31
31
  else {
@@ -1,7 +1,7 @@
1
+ import { get } from './get.mjs';
1
2
  import { isDeepKey } from '../_internal/isDeepKey.mjs';
2
3
  import { toKey } from '../_internal/toKey.mjs';
3
4
  import { toPath } from '../util/toPath.mjs';
4
- import { get } from './get.mjs';
5
5
 
6
6
  function unset(obj, path) {
7
7
  if (obj == null) {
@@ -1,3 +1,4 @@
1
+ import { isObject } from './isObject.mjs';
1
2
  import { isPrimitive } from '../../predicate/isPrimitive.mjs';
2
3
 
3
4
  function isMatch(target, source) {
@@ -46,6 +47,9 @@ function isMatch(target, source) {
46
47
  return false;
47
48
  }
48
49
  default: {
50
+ if (!isObject(target)) {
51
+ return target === source || (Number.isNaN(target) && Number.isNaN(source));
52
+ }
49
53
  return !source;
50
54
  }
51
55
  }
@@ -1,5 +1,5 @@
1
- import { cloneDeep } from '../../object/cloneDeep.mjs';
2
1
  import { isMatch } from './isMatch.mjs';
2
+ import { cloneDeep } from '../../object/cloneDeep.mjs';
3
3
 
4
4
  function matches(source) {
5
5
  source = cloneDeep(source);
@@ -1,8 +1,8 @@
1
+ import { isMatch } from './isMatch.mjs';
1
2
  import { toKey } from '../_internal/toKey.mjs';
2
3
  import { cloneDeep } from '../object/cloneDeep.mjs';
3
4
  import { get } from '../object/get.mjs';
4
5
  import { has } from '../object/has.mjs';
5
- import { isMatch } from './isMatch.mjs';
6
6
 
7
7
  function matchesProperty(property, source) {
8
8
  switch (typeof property) {