ut2 1.5.6 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +11 -0
  2. package/dist/ut2.js +239 -101
  3. package/dist/ut2.js.map +1 -1
  4. package/dist/ut2.min.js +1 -1
  5. package/dist/ut2.min.js.map +1 -1
  6. package/es/countBy.js +11 -13
  7. package/es/difference.js +2 -0
  8. package/es/every.js +16 -0
  9. package/es/filter.js +15 -0
  10. package/es/find.js +16 -0
  11. package/es/forEach.js +6 -0
  12. package/es/forEachRight.js +6 -0
  13. package/es/groupBy.js +13 -13
  14. package/es/index.js +11 -0
  15. package/es/internals/createExtremum.js +8 -18
  16. package/es/internals/createForEach.js +23 -0
  17. package/es/internals/createReduce.js +29 -0
  18. package/es/internals/helpers.js +1 -1
  19. package/es/intersection.js +2 -0
  20. package/es/isEmpty.js +1 -1
  21. package/es/keyBy.js +8 -8
  22. package/es/keys.js +11 -0
  23. package/es/map.js +13 -0
  24. package/es/merge.js +32 -22
  25. package/es/orderBy.js +9 -9
  26. package/es/partition.js +7 -7
  27. package/es/range.js +28 -0
  28. package/es/reduce.js +6 -0
  29. package/es/reduceRight.js +6 -0
  30. package/es/some.js +16 -0
  31. package/es/toString.js +1 -1
  32. package/es/uniq.js +5 -13
  33. package/es/xor.js +2 -0
  34. package/lib/countBy.js +11 -13
  35. package/lib/difference.js +2 -0
  36. package/lib/every.js +18 -0
  37. package/lib/filter.js +17 -0
  38. package/lib/find.js +18 -0
  39. package/lib/forEach.js +8 -0
  40. package/lib/forEachRight.js +8 -0
  41. package/lib/groupBy.js +13 -13
  42. package/lib/index.js +22 -0
  43. package/lib/internals/createExtremum.js +8 -18
  44. package/lib/internals/createForEach.js +25 -0
  45. package/lib/internals/createReduce.js +31 -0
  46. package/lib/internals/helpers.js +1 -1
  47. package/lib/intersection.js +2 -0
  48. package/lib/isEmpty.js +2 -2
  49. package/lib/keyBy.js +8 -8
  50. package/lib/keys.js +13 -0
  51. package/lib/map.js +15 -0
  52. package/lib/merge.js +32 -22
  53. package/lib/orderBy.js +9 -9
  54. package/lib/partition.js +7 -7
  55. package/lib/range.js +30 -0
  56. package/lib/reduce.js +8 -0
  57. package/lib/reduceRight.js +8 -0
  58. package/lib/some.js +18 -0
  59. package/lib/toString.js +1 -1
  60. package/lib/uniq.js +5 -13
  61. package/lib/xor.js +2 -0
  62. package/package.json +1 -1
  63. package/types/allKeys.d.ts +1 -1
  64. package/types/allKeysIn.d.ts +1 -1
  65. package/types/conformsTo.d.ts +2 -1
  66. package/types/countBy.d.ts +3 -24
  67. package/types/difference.d.ts +3 -2
  68. package/types/every.d.ts +6 -0
  69. package/types/filter.d.ts +6 -0
  70. package/types/find.d.ts +6 -0
  71. package/types/forEach.d.ts +36 -0
  72. package/types/forEachRight.d.ts +36 -0
  73. package/types/groupBy.d.ts +3 -24
  74. package/types/index.d.ts +11 -0
  75. package/types/internals/compare.d.ts +2 -1
  76. package/types/internals/createExtremum.d.ts +2 -1
  77. package/types/internals/createForEach.d.ts +15 -0
  78. package/types/internals/createIteratee.d.ts +2 -2
  79. package/types/internals/createReduce.d.ts +19 -0
  80. package/types/intersection.d.ts +3 -2
  81. package/types/isArrayBuffer.d.ts +1 -1
  82. package/types/isArrayLike.d.ts +1 -1
  83. package/types/isError.d.ts +1 -1
  84. package/types/isWeakMap.d.ts +1 -1
  85. package/types/isWeakSet.d.ts +1 -1
  86. package/types/keyBy.d.ts +3 -24
  87. package/types/keys.d.ts +24 -0
  88. package/types/keysIn.d.ts +1 -1
  89. package/types/map.d.ts +6 -0
  90. package/types/max.d.ts +3 -2
  91. package/types/merge.d.ts +6 -2
  92. package/types/min.d.ts +3 -2
  93. package/types/orderBy.d.ts +3 -39
  94. package/types/partition.d.ts +3 -34
  95. package/types/range.d.ts +4 -0
  96. package/types/reduce.d.ts +38 -0
  97. package/types/reduceRight.d.ts +38 -0
  98. package/types/some.d.ts +6 -0
  99. package/types/union.d.ts +2 -1
  100. package/types/uniq.d.ts +2 -1
  101. package/types/xor.d.ts +3 -2
  102. /package/es/internals/{keys.js → specialKeys.js} +0 -0
  103. /package/lib/internals/{keys.js → specialKeys.js} +0 -0
  104. /package/types/internals/{keys.d.ts → specialKeys.d.ts} +0 -0
package/es/countBy.js CHANGED
@@ -1,20 +1,18 @@
1
+ import forEach from './forEach.js';
1
2
  import createIteratee from './internals/createIteratee.js';
2
- import isArray from './isArray.js';
3
3
 
4
4
  function countBy(collection, iteratee) {
5
5
  var result = {};
6
- if (isArray(collection)) {
7
- var internalIteratee_1 = createIteratee(iteratee);
8
- collection.forEach(function (item) {
9
- var key = internalIteratee_1(item);
10
- if (key in result) {
11
- ++result[key];
12
- }
13
- else {
14
- result[key] = 1;
15
- }
16
- });
17
- }
6
+ var internalIteratee = createIteratee(iteratee);
7
+ forEach(collection, function (item) {
8
+ var key = internalIteratee(item);
9
+ if (key in result) {
10
+ ++result[key];
11
+ }
12
+ else {
13
+ result[key] = 1;
14
+ }
15
+ });
18
16
  return result;
19
17
  }
20
18
 
package/es/difference.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import eq from './eq.js';
2
+ import identity from './identity.js';
2
3
  import createIteratee from './internals/createIteratee.js';
3
4
  import isArray from './isArray.js';
4
5
 
5
6
  function difference(array, values, iteratee, strictCheck) {
7
+ if (iteratee === void 0) { iteratee = identity; }
6
8
  if (strictCheck === void 0) { strictCheck = false; }
7
9
  if (!isArray(array)) {
8
10
  return [];
package/es/every.js ADDED
@@ -0,0 +1,16 @@
1
+ import forEach from './forEach.js';
2
+ import identity from './identity.js';
3
+
4
+ function every(collection, predicate) {
5
+ if (predicate === void 0) { predicate = identity; }
6
+ var result = true;
7
+ forEach(collection, function (item, index, arr) {
8
+ if (!predicate(item, index, arr)) {
9
+ result = false;
10
+ return false;
11
+ }
12
+ });
13
+ return result;
14
+ }
15
+
16
+ export { every as default };
package/es/filter.js ADDED
@@ -0,0 +1,15 @@
1
+ import forEach from './forEach.js';
2
+ import identity from './identity.js';
3
+
4
+ function filter(array, predicate) {
5
+ if (predicate === void 0) { predicate = identity; }
6
+ var results = [];
7
+ forEach(array, function (item, index) {
8
+ if (predicate(item, index, array)) {
9
+ results.push(item);
10
+ }
11
+ });
12
+ return results;
13
+ }
14
+
15
+ export { filter as default };
package/es/find.js ADDED
@@ -0,0 +1,16 @@
1
+ import forEach from './forEach.js';
2
+ import identity from './identity.js';
3
+
4
+ function find(collection, predicate) {
5
+ if (predicate === void 0) { predicate = identity; }
6
+ var result;
7
+ forEach(collection, function (item, index, arr) {
8
+ if (predicate(item, index, arr)) {
9
+ result = item;
10
+ return false;
11
+ }
12
+ });
13
+ return result;
14
+ }
15
+
16
+ export { find as default };
package/es/forEach.js ADDED
@@ -0,0 +1,6 @@
1
+ import createForEach from './internals/createForEach.js';
2
+
3
+ var forEach = createForEach(1);
4
+ var forEach$1 = forEach;
5
+
6
+ export { forEach$1 as default };
@@ -0,0 +1,6 @@
1
+ import createForEach from './internals/createForEach.js';
2
+
3
+ var forEachRight = createForEach(-1);
4
+ var forEachRight$1 = forEachRight;
5
+
6
+ export { forEachRight$1 as default };
package/es/groupBy.js CHANGED
@@ -1,20 +1,20 @@
1
+ import forEach from './forEach.js';
2
+ import identity from './identity.js';
1
3
  import createIteratee from './internals/createIteratee.js';
2
- import isArray from './isArray.js';
3
4
 
4
5
  function groupBy(collection, iteratee) {
6
+ if (iteratee === void 0) { iteratee = identity; }
5
7
  var result = {};
6
- if (isArray(collection)) {
7
- var internalIteratee_1 = createIteratee(iteratee);
8
- collection.forEach(function (item) {
9
- var key = internalIteratee_1(item);
10
- if (key in result) {
11
- result[key].push(item);
12
- }
13
- else {
14
- result[key] = [item];
15
- }
16
- });
17
- }
8
+ var internalIteratee = createIteratee(iteratee);
9
+ forEach(collection, function (item) {
10
+ var key = internalIteratee(item);
11
+ if (key in result) {
12
+ result[key].push(item);
13
+ }
14
+ else {
15
+ result[key] = [item];
16
+ }
17
+ });
18
18
  return result;
19
19
  }
20
20
 
package/es/index.js CHANGED
@@ -11,10 +11,19 @@ export { default as unzip } from './unzip.js';
11
11
  export { default as xor } from './xor.js';
12
12
  export { default as zip } from './zip.js';
13
13
  export { default as countBy } from './countBy.js';
14
+ export { default as every } from './every.js';
15
+ export { default as find } from './find.js';
16
+ export { default as filter } from './filter.js';
17
+ export { default as forEach } from './forEach.js';
18
+ export { default as forEachRight } from './forEachRight.js';
14
19
  export { default as groupBy } from './groupBy.js';
15
20
  export { default as keyBy } from './keyBy.js';
16
21
  export { default as orderBy } from './orderBy.js';
22
+ export { default as map } from './map.js';
17
23
  export { default as partition } from './partition.js';
24
+ export { default as reduce } from './reduce.js';
25
+ export { default as reduceRight } from './reduceRight.js';
26
+ export { default as some } from './some.js';
18
27
  export { default as after } from './after.js';
19
28
  export { default as before } from './before.js';
20
29
  export { default as debounce } from './debounce.js';
@@ -71,6 +80,7 @@ export { default as random } from './random.js';
71
80
  export { default as randomInt } from './randomInt.js';
72
81
  export { default as allKeys } from './allKeys.js';
73
82
  export { default as allKeysIn } from './allKeysIn.js';
83
+ export { default as keys } from './keys.js';
74
84
  export { default as keysIn } from './keysIn.js';
75
85
  export { default as merge } from './merge.js';
76
86
  export { default as omit } from './omit.js';
@@ -102,6 +112,7 @@ export { default as lt } from './lt.js';
102
112
  export { default as lte } from './lte.js';
103
113
  export { default as noop } from './noop.js';
104
114
  export { default as nthArg } from './nthArg.js';
115
+ export { default as range } from './range.js';
105
116
  export { default as sleep } from './sleep.js';
106
117
  export { default as times } from './times.js';
107
118
  export { default as toFinite } from './toFinite.js';
@@ -1,6 +1,5 @@
1
1
  import isArray from '../isArray.js';
2
2
  import isSymbol from '../isSymbol.js';
3
- import isUndefined from '../isUndefined.js';
4
3
  import createIteratee from './createIteratee.js';
5
4
 
6
5
  function createExtremum(array, comparator, iteratee) {
@@ -8,23 +7,14 @@ function createExtremum(array, comparator, iteratee) {
8
7
  return;
9
8
  }
10
9
  var result, computed;
11
- if (isUndefined(iteratee)) {
12
- array.forEach(function (value) {
13
- if (value != null && (result === undefined ? value === value && !isSymbol(value) : comparator(value, result))) {
14
- result = value;
15
- }
16
- });
17
- }
18
- else {
19
- var internalIteratee_1 = createIteratee(iteratee);
20
- array.forEach(function (value) {
21
- var current = internalIteratee_1(value);
22
- if (current != null && (computed === undefined ? current === current && !isSymbol(current) : comparator(current, computed))) {
23
- computed = current;
24
- result = value;
25
- }
26
- });
27
- }
10
+ var internalIteratee = createIteratee(iteratee);
11
+ array.forEach(function (value) {
12
+ var current = internalIteratee(value);
13
+ if (current != null && (computed === undefined ? current === current && !isSymbol(current) : comparator(current, computed))) {
14
+ computed = current;
15
+ result = value;
16
+ }
17
+ });
28
18
  return result;
29
19
  }
30
20
 
@@ -0,0 +1,23 @@
1
+ import identity from '../identity.js';
2
+ import isArrayLike from '../isArrayLike.js';
3
+ import keys from '../keys.js';
4
+
5
+ function createForEach(dir) {
6
+ function forEach(collection, iteratee) {
7
+ if (iteratee === void 0) { iteratee = identity; }
8
+ var _keys = !isArrayLike(collection) && keys(collection);
9
+ var len = (_keys || collection).length;
10
+ var i = dir > 0 ? 0 : len - 1;
11
+ while (i >= 0 && i < len) {
12
+ var currentKey = _keys ? _keys[i] : i;
13
+ if (iteratee(collection[currentKey], currentKey, collection) === false) {
14
+ break;
15
+ }
16
+ i += dir;
17
+ }
18
+ return collection;
19
+ }
20
+ return forEach;
21
+ }
22
+
23
+ export { createForEach as default };
@@ -0,0 +1,29 @@
1
+ import identity from '../identity.js';
2
+ import isArrayLike from '../isArrayLike.js';
3
+ import keys from '../keys.js';
4
+
5
+ function createReduce(dir) {
6
+ function reducer(collection, iteratee, memo, initial) {
7
+ var _keys = !isArrayLike(collection) && keys(collection);
8
+ var len = (_keys || collection).length;
9
+ var i = dir > 0 ? 0 : len - 1;
10
+ if (!initial && len > 0) {
11
+ memo = collection[_keys ? _keys[i] : i];
12
+ i += dir;
13
+ }
14
+ while (i >= 0 && i < len) {
15
+ var currentKey = _keys ? _keys[i] : i;
16
+ memo = iteratee(memo, collection[currentKey], currentKey, collection);
17
+ i += dir;
18
+ }
19
+ return memo;
20
+ }
21
+ function reduce(collection, iteratee, initialValue) {
22
+ if (iteratee === void 0) { iteratee = identity; }
23
+ var initial = arguments.length >= 3;
24
+ return reducer(collection, iteratee, initialValue, initial);
25
+ }
26
+ return reduce;
27
+ }
28
+
29
+ export { createReduce as default };
@@ -1,7 +1,7 @@
1
1
  import getTag from './getTag.js';
2
2
  import { argumentsTag, functionProtoToString } from './native.js';
3
3
 
4
- var VERSION = "1.5.6";
4
+ var VERSION = "1.7.0";
5
5
  var supportedArgumentsType = getTag((function () { return arguments; })()) === argumentsTag;
6
6
  var FUNC_ERROR_TEXT = 'Expected a function';
7
7
  function toSource(func) {
@@ -1,8 +1,10 @@
1
1
  import eq from './eq.js';
2
+ import identity from './identity.js';
2
3
  import createIteratee from './internals/createIteratee.js';
3
4
  import isArray from './isArray.js';
4
5
 
5
6
  function intersection(array, other, iteratee, strictCheck) {
7
+ if (iteratee === void 0) { iteratee = identity; }
6
8
  if (strictCheck === void 0) { strictCheck = false; }
7
9
  if (!isArray(array) || !isArray(other)) {
8
10
  return [];
package/es/isEmpty.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import getTag from './internals/getTag.js';
2
- import keys from './internals/keys.js';
2
+ import keys from './internals/specialKeys.js';
3
3
  import { mapTag, setTag } from './internals/native.js';
4
4
  import isArrayLike from './isArrayLike.js';
5
5
  import isNil from './isNil.js';
package/es/keyBy.js CHANGED
@@ -1,15 +1,15 @@
1
+ import forEach from './forEach.js';
2
+ import identity from './identity.js';
1
3
  import createIteratee from './internals/createIteratee.js';
2
- import isArray from './isArray.js';
3
4
 
4
5
  function keyBy(collection, iteratee) {
6
+ if (iteratee === void 0) { iteratee = identity; }
5
7
  var result = {};
6
- if (isArray(collection)) {
7
- var internalIteratee_1 = createIteratee(iteratee);
8
- collection.forEach(function (item) {
9
- var key = internalIteratee_1(item);
10
- result[key] = item;
11
- });
12
- }
8
+ var internalIteratee = createIteratee(iteratee);
9
+ forEach(collection, function (item) {
10
+ var key = internalIteratee(item);
11
+ result[key] = item;
12
+ });
13
13
  return result;
14
14
  }
15
15
 
package/es/keys.js ADDED
@@ -0,0 +1,11 @@
1
+ import { objectKeys } from './internals/native.js';
2
+ import isObject from './isObject.js';
3
+
4
+ function keys(object) {
5
+ if (!isObject(object)) {
6
+ return [];
7
+ }
8
+ return objectKeys(object);
9
+ }
10
+
11
+ export { keys as default };
package/es/map.js ADDED
@@ -0,0 +1,13 @@
1
+ import forEach from './forEach.js';
2
+ import identity from './identity.js';
3
+
4
+ function map(collection, iteratee) {
5
+ if (iteratee === void 0) { iteratee = identity; }
6
+ var result = [];
7
+ forEach(collection, function (item, index, arr) {
8
+ result.push(iteratee(item, index, arr));
9
+ });
10
+ return result;
11
+ }
12
+
13
+ export { map as default };
package/es/merge.js CHANGED
@@ -1,44 +1,54 @@
1
- import allKeysIn from './allKeysIn.js';
1
+ import keysIn from './keysIn.js';
2
2
  import isArray from './isArray.js';
3
3
  import isObject from './isObject.js';
4
4
  import isObjectLike from './isObjectLike.js';
5
5
  import isPlainObject from './isPlainObject.js';
6
6
 
7
- function baseMerge(object, source, customizer, storage) {
8
- if (storage === void 0) { storage = new WeakMap(); }
7
+ function baseMerge(object, source, getKeys, customizer, stack) {
8
+ if (stack === void 0) { stack = new WeakMap(); }
9
9
  var obj = Object(object);
10
10
  if (!isObject(source) || obj === source) {
11
11
  return obj;
12
12
  }
13
- var keys = allKeysIn(source);
13
+ var keys = getKeys(source);
14
+ var hasCustomizer = typeof customizer === 'function';
14
15
  keys.forEach(function (key) {
15
16
  var srcValue = source[key];
16
- var newValue = typeof customizer === 'function' ? customizer(obj[key], srcValue, key, obj, source) : undefined;
17
- if (newValue === undefined) {
18
- newValue = srcValue;
19
- }
20
- if (isObjectLike(newValue) && !storage.has(newValue)) {
21
- storage.set(newValue, true);
22
- var objValue = obj[key];
23
- var newObjValue = void 0;
24
- if (isArray(newValue)) {
25
- newObjValue = isArray(objValue) ? objValue : [];
26
- }
27
- else if (isPlainObject(newValue)) {
28
- newObjValue = isPlainObject(objValue) ? objValue : {};
29
- }
30
- obj[key] = newObjValue ? baseMerge(newObjValue, newValue, customizer, storage) : newValue;
17
+ var srcIsObj = isObject(srcValue);
18
+ if (srcIsObj && stack.has(srcValue)) {
19
+ obj[key] = srcValue;
31
20
  }
32
21
  else {
33
- if (newValue !== undefined || (newValue === undefined && !(key in obj))) {
22
+ var newValue = hasCustomizer ? customizer(obj[key], srcValue, key, obj, source) : undefined;
23
+ if (newValue !== undefined) {
34
24
  obj[key] = newValue;
35
25
  }
26
+ else {
27
+ var objValue = obj[key];
28
+ var newObjValue = void 0;
29
+ if (srcIsObj) {
30
+ stack.set(srcValue, true);
31
+ if (isArray(srcValue)) {
32
+ newObjValue = isArray(objValue) ? objValue : [];
33
+ }
34
+ else if (isPlainObject(srcValue)) {
35
+ newObjValue = isObjectLike(objValue) ? objValue : {};
36
+ }
37
+ }
38
+ if (newObjValue) {
39
+ obj[key] = baseMerge(newObjValue, srcValue, getKeys, customizer, stack);
40
+ }
41
+ else if (srcValue !== undefined || !(key in obj)) {
42
+ obj[key] = srcValue;
43
+ }
44
+ }
36
45
  }
37
46
  });
38
47
  return obj;
39
48
  }
40
- function merge(object, source, customizer) {
41
- return baseMerge(object, source, customizer);
49
+ function merge(object, source, customizer, getKeys) {
50
+ if (getKeys === void 0) { getKeys = keysIn; }
51
+ return baseMerge(object, source, getKeys, customizer);
42
52
  }
43
53
 
44
54
  export { merge as default };
package/es/orderBy.js CHANGED
@@ -2,21 +2,21 @@ import identity from './identity.js';
2
2
  import createIteratee from './internals/createIteratee.js';
3
3
  import { compareMultiple } from './internals/compare.js';
4
4
  import isArray from './isArray.js';
5
+ import forEach from './forEach.js';
5
6
 
6
7
  function orderBy(collection, iteratees, orders) {
7
8
  var result = [];
8
9
  iteratees = (isArray(iteratees) ? iteratees : iteratees !== undefined ? [iteratees] : [identity]);
9
10
  orders = (isArray(orders) ? orders : orders !== undefined ? [orders] : []);
10
- if (isArray(collection)) {
11
- collection.forEach(function (item, index) {
12
- var criteria = iteratees.map(function (iteratee) { return createIteratee(iteratee)(item); });
13
- result.push({
14
- criteria: criteria,
15
- index: index,
16
- value: item
17
- });
11
+ var index = -1;
12
+ forEach(collection, function (item) {
13
+ var criteria = iteratees.map(function (iteratee) { return createIteratee(iteratee)(item); });
14
+ result.push({
15
+ criteria: criteria,
16
+ index: ++index,
17
+ value: item
18
18
  });
19
- }
19
+ });
20
20
  return result.sort(function (a, b) { return compareMultiple(a, b, orders); }).map(function (item) { return item.value; });
21
21
  }
22
22
 
package/es/partition.js CHANGED
@@ -1,14 +1,14 @@
1
+ import forEach from './forEach.js';
2
+ import identity from './identity.js';
1
3
  import createIteratee from './internals/createIteratee.js';
2
- import isArray from './isArray.js';
3
4
 
4
5
  function partition(collection, predicate) {
6
+ if (predicate === void 0) { predicate = identity; }
5
7
  var result = [[], []];
6
- if (isArray(collection)) {
7
- var internalIteratee_1 = createIteratee(predicate);
8
- collection.forEach(function (item) {
9
- result[internalIteratee_1(item) ? 0 : 1].push(item);
10
- });
11
- }
8
+ var internalIteratee = createIteratee(predicate);
9
+ forEach(collection, function (item) {
10
+ result[internalIteratee(item) ? 0 : 1].push(item);
11
+ });
12
12
  return result;
13
13
  }
14
14
 
package/es/range.js ADDED
@@ -0,0 +1,28 @@
1
+ import { mathMax, mathCeil } from './internals/native.js';
2
+ import isNil from './isNil.js';
3
+ import toFinite from './toFinite.js';
4
+
5
+ function range(start, end, step) {
6
+ start = toFinite(start);
7
+ if (isNil(end)) {
8
+ end = start;
9
+ start = 0;
10
+ }
11
+ else {
12
+ end = toFinite(end);
13
+ }
14
+ step = toFinite(step);
15
+ if (!step) {
16
+ step = start < end ? 1 : -1;
17
+ }
18
+ var index = -1;
19
+ var length = mathMax(mathCeil((end - start) / step), 0);
20
+ var result = Array(length);
21
+ while (length--) {
22
+ result[++index] = start;
23
+ start += step;
24
+ }
25
+ return result;
26
+ }
27
+
28
+ export { range as default };
package/es/reduce.js ADDED
@@ -0,0 +1,6 @@
1
+ import createReduce from './internals/createReduce.js';
2
+
3
+ var reduce = createReduce(1);
4
+ var reduce$1 = reduce;
5
+
6
+ export { reduce$1 as default };
@@ -0,0 +1,6 @@
1
+ import createReduce from './internals/createReduce.js';
2
+
3
+ var reduceRight = createReduce(-1);
4
+ var reduceRight$1 = reduceRight;
5
+
6
+ export { reduceRight$1 as default };
package/es/some.js ADDED
@@ -0,0 +1,16 @@
1
+ import forEach from './forEach.js';
2
+ import identity from './identity.js';
3
+
4
+ function some(collection, predicate) {
5
+ if (predicate === void 0) { predicate = identity; }
6
+ var result = false;
7
+ forEach(collection, function (item, index, arr) {
8
+ if (predicate(item, index, arr)) {
9
+ result = true;
10
+ return false;
11
+ }
12
+ });
13
+ return result;
14
+ }
15
+
16
+ export { some as default };
package/es/toString.js CHANGED
@@ -9,7 +9,7 @@ function baseToString(value) {
9
9
  return value;
10
10
  }
11
11
  if (isArray(value)) {
12
- return "".concat(value.map(baseToString));
12
+ return '' + value.map(baseToString);
13
13
  }
14
14
  if (isSymbol(value)) {
15
15
  return symbolToString ? symbolToString.call(value) : '';
package/es/uniq.js CHANGED
@@ -1,25 +1,17 @@
1
1
  import eq from './eq.js';
2
2
  import createIteratee from './internals/createIteratee.js';
3
3
  import isArray from './isArray.js';
4
- import isUndefined from './isUndefined.js';
5
4
 
6
5
  function uniq(array, iteratee, strickCheck) {
7
6
  if (strickCheck === void 0) { strickCheck = false; }
8
7
  if (!isArray(array)) {
9
8
  return [];
10
9
  }
11
- if (isUndefined(iteratee)) {
12
- return array.filter(function (value, index, arr) {
13
- return arr.findIndex(function (item) { return eq(item, value, strickCheck); }) === index;
14
- });
15
- }
16
- else {
17
- var internalIteratee_1 = createIteratee(iteratee);
18
- return array.filter(function (value, index, arr) {
19
- var current = internalIteratee_1(value);
20
- return arr.findIndex(function (item) { return eq(internalIteratee_1(item), current, strickCheck); }) === index;
21
- });
22
- }
10
+ var internalIteratee = createIteratee(iteratee);
11
+ return array.filter(function (value, index, arr) {
12
+ var current = internalIteratee(value);
13
+ return arr.findIndex(function (item) { return eq(internalIteratee(item), current, strickCheck); }) === index;
14
+ });
23
15
  }
24
16
 
25
17
  export { uniq as default };
package/es/xor.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import difference from './difference.js';
2
+ import identity from './identity.js';
2
3
  import createIteratee from './internals/createIteratee.js';
3
4
  import intersection from './intersection.js';
4
5
  import isArray from './isArray.js';
@@ -7,6 +8,7 @@ import uniq from './uniq.js';
7
8
 
8
9
  function xor(array, other, iteratee, strickCheck) {
9
10
  if (other === void 0) { other = []; }
11
+ if (iteratee === void 0) { iteratee = identity; }
10
12
  if (strickCheck === void 0) { strickCheck = false; }
11
13
  if (!isArray(array) && !isArray(other)) {
12
14
  return [];
package/lib/countBy.js CHANGED
@@ -1,22 +1,20 @@
1
1
  'use strict';
2
2
 
3
+ var forEach = require('./forEach.js');
3
4
  var createIteratee = require('./internals/createIteratee.js');
4
- var isArray = require('./isArray.js');
5
5
 
6
6
  function countBy(collection, iteratee) {
7
7
  var result = {};
8
- if (isArray(collection)) {
9
- var internalIteratee_1 = createIteratee(iteratee);
10
- collection.forEach(function (item) {
11
- var key = internalIteratee_1(item);
12
- if (key in result) {
13
- ++result[key];
14
- }
15
- else {
16
- result[key] = 1;
17
- }
18
- });
19
- }
8
+ var internalIteratee = createIteratee(iteratee);
9
+ forEach(collection, function (item) {
10
+ var key = internalIteratee(item);
11
+ if (key in result) {
12
+ ++result[key];
13
+ }
14
+ else {
15
+ result[key] = 1;
16
+ }
17
+ });
20
18
  return result;
21
19
  }
22
20