ut2 1.8.0 → 1.8.1
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.
- package/dist/ut2.js +57 -54
- package/dist/ut2.js.map +1 -1
- package/dist/ut2.min.js +1 -1
- package/dist/ut2.min.js.map +1 -1
- package/es/before.js +2 -1
- package/es/clamp.js +7 -6
- package/es/conformsTo.js +2 -1
- package/es/internals/baseDebounce.js +15 -14
- package/es/internals/createExtremum.js +2 -1
- package/es/internals/getTagWithBugfix.js +7 -7
- package/es/internals/helpers.js +1 -1
- package/es/internals/isEqualDeep.js +4 -4
- package/es/internals/native.js +9 -6
- package/es/internals/nodeUtil.js +4 -2
- package/es/isBlob.js +2 -2
- package/es/isEqual.js +2 -1
- package/es/isMatch.js +5 -5
- package/es/isUndefined.js +3 -1
- package/es/merge.js +4 -3
- package/es/nth.js +2 -1
- package/es/orderBy.js +3 -2
- package/es/toString.js +2 -2
- package/lib/before.js +2 -1
- package/lib/clamp.js +7 -6
- package/lib/conformsTo.js +2 -1
- package/lib/internals/baseDebounce.js +15 -14
- package/lib/internals/createExtremum.js +2 -1
- package/lib/internals/getTagWithBugfix.js +6 -6
- package/lib/internals/helpers.js +1 -1
- package/lib/internals/isEqualDeep.js +3 -3
- package/lib/internals/native.js +8 -5
- package/lib/internals/nodeUtil.js +4 -2
- package/lib/isBlob.js +1 -1
- package/lib/isEqual.js +2 -1
- package/lib/isMatch.js +4 -4
- package/lib/isUndefined.js +3 -1
- package/lib/merge.js +4 -3
- package/lib/nth.js +2 -1
- package/lib/orderBy.js +3 -2
- package/lib/toString.js +1 -1
- package/package.json +1 -1
- package/types/internals/compare.d.ts +4 -4
- package/types/internals/native.d.ts +3 -0
- package/types/orderBy.d.ts +3 -3
package/es/before.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import defaultTo from './defaultTo.js';
|
|
2
2
|
import { FUNC_ERROR_TEXT } from './internals/helpers.js';
|
|
3
|
+
import { nativeUndefined } from './internals/native.js';
|
|
3
4
|
import toNumber from './toNumber.js';
|
|
4
5
|
|
|
5
6
|
function before(n, func) {
|
|
@@ -13,7 +14,7 @@ function before(n, func) {
|
|
|
13
14
|
result = func.apply(this, arguments);
|
|
14
15
|
}
|
|
15
16
|
if (n <= 1) {
|
|
16
|
-
func =
|
|
17
|
+
func = nativeUndefined;
|
|
17
18
|
}
|
|
18
19
|
return result;
|
|
19
20
|
};
|
package/es/clamp.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import defaultTo from './defaultTo.js';
|
|
2
|
+
import { nativeUndefined } from './internals/native.js';
|
|
2
3
|
import toNumber from './toNumber.js';
|
|
3
4
|
|
|
4
5
|
var clamp = function (number, lower, upper) {
|
|
5
|
-
if (upper ===
|
|
6
|
+
if (upper === nativeUndefined) {
|
|
6
7
|
upper = lower;
|
|
7
|
-
lower =
|
|
8
|
+
lower = nativeUndefined;
|
|
8
9
|
}
|
|
9
|
-
if (upper !==
|
|
10
|
+
if (upper !== nativeUndefined) {
|
|
10
11
|
upper = defaultTo(toNumber(upper), 0);
|
|
11
12
|
}
|
|
12
|
-
if (lower !==
|
|
13
|
+
if (lower !== nativeUndefined) {
|
|
13
14
|
lower = defaultTo(toNumber(lower), 0);
|
|
14
15
|
}
|
|
15
16
|
number = toNumber(number);
|
|
16
17
|
if (number === number) {
|
|
17
|
-
if (upper !==
|
|
18
|
+
if (upper !== nativeUndefined) {
|
|
18
19
|
number = number <= upper ? number : upper;
|
|
19
20
|
}
|
|
20
|
-
if (lower !==
|
|
21
|
+
if (lower !== nativeUndefined) {
|
|
21
22
|
number = number >= lower ? number : lower;
|
|
22
23
|
}
|
|
23
24
|
}
|
package/es/conformsTo.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import allKeys from './allKeys.js';
|
|
2
|
+
import { nativeUndefined } from './internals/native.js';
|
|
2
3
|
import isNil from './isNil.js';
|
|
3
4
|
|
|
4
5
|
var conformsTo = function (object, source) {
|
|
@@ -14,7 +15,7 @@ var conformsTo = function (object, source) {
|
|
|
14
15
|
var key = props[i];
|
|
15
16
|
var predicate = source[key];
|
|
16
17
|
var value = object[key];
|
|
17
|
-
if ((value ===
|
|
18
|
+
if ((value === nativeUndefined && !(key in object)) || !predicate(value)) {
|
|
18
19
|
return false;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import defaultTo from '../defaultTo.js';
|
|
2
2
|
import toNumber from '../toNumber.js';
|
|
3
3
|
import { FUNC_ERROR_TEXT } from './helpers.js';
|
|
4
|
+
import { nativeUndefined } from './native.js';
|
|
4
5
|
|
|
5
6
|
function baseDebounce(func, wait, immediate, __throttle__) {
|
|
6
7
|
if (__throttle__ === void 0) { __throttle__ = false; }
|
|
@@ -10,7 +11,7 @@ function baseDebounce(func, wait, immediate, __throttle__) {
|
|
|
10
11
|
var timer, lastCallTime, lastInvokeTime, lastArgs, lastThis, result;
|
|
11
12
|
wait = defaultTo(toNumber(wait), 0);
|
|
12
13
|
function shouldInvoke(time) {
|
|
13
|
-
if (lastCallTime ===
|
|
14
|
+
if (lastCallTime === nativeUndefined) {
|
|
14
15
|
return true;
|
|
15
16
|
}
|
|
16
17
|
var timeSinceLastCall = time - lastCallTime;
|
|
@@ -20,7 +21,7 @@ function baseDebounce(func, wait, immediate, __throttle__) {
|
|
|
20
21
|
function invokeFunc(time) {
|
|
21
22
|
lastInvokeTime = time;
|
|
22
23
|
result = func.apply(lastThis, lastArgs);
|
|
23
|
-
lastThis = lastArgs =
|
|
24
|
+
lastThis = lastArgs = nativeUndefined;
|
|
24
25
|
return result;
|
|
25
26
|
}
|
|
26
27
|
function debounced() {
|
|
@@ -32,36 +33,36 @@ function baseDebounce(func, wait, immediate, __throttle__) {
|
|
|
32
33
|
lastArgs = args;
|
|
33
34
|
var time = Date.now();
|
|
34
35
|
var isInvoke = shouldInvoke(time);
|
|
35
|
-
var waitTime = !__throttle__ ? wait : !isInvoke && lastCallTime !==
|
|
36
|
+
var waitTime = !__throttle__ ? wait : !isInvoke && lastCallTime !== nativeUndefined && timer === nativeUndefined ? wait - (time - lastCallTime) : wait;
|
|
36
37
|
lastCallTime = time;
|
|
37
38
|
if (isInvoke) {
|
|
38
|
-
if (immediate && timer ===
|
|
39
|
+
if (immediate && timer === nativeUndefined) {
|
|
39
40
|
return invokeFunc(time);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
if (timer !==
|
|
43
|
+
if (timer !== nativeUndefined && !__throttle__) {
|
|
43
44
|
clearTimeout(timer);
|
|
44
|
-
timer =
|
|
45
|
+
timer = nativeUndefined;
|
|
45
46
|
}
|
|
46
|
-
if (timer ===
|
|
47
|
+
if (timer === nativeUndefined) {
|
|
47
48
|
timer = setTimeout(function () {
|
|
48
|
-
timer =
|
|
49
|
+
timer = nativeUndefined;
|
|
49
50
|
invokeFunc(Date.now());
|
|
50
51
|
}, waitTime);
|
|
51
52
|
}
|
|
52
53
|
return result;
|
|
53
54
|
}
|
|
54
55
|
function cancel() {
|
|
55
|
-
if (timer !==
|
|
56
|
+
if (timer !== nativeUndefined) {
|
|
56
57
|
clearTimeout(timer);
|
|
57
|
-
timer =
|
|
58
|
+
timer = nativeUndefined;
|
|
58
59
|
}
|
|
59
|
-
lastCallTime = timer = lastArgs = lastThis =
|
|
60
|
+
lastCallTime = timer = lastArgs = lastThis = nativeUndefined;
|
|
60
61
|
}
|
|
61
62
|
function flush() {
|
|
62
|
-
if (timer !==
|
|
63
|
+
if (timer !== nativeUndefined) {
|
|
63
64
|
clearTimeout(timer);
|
|
64
|
-
timer =
|
|
65
|
+
timer = nativeUndefined;
|
|
65
66
|
if (lastArgs) {
|
|
66
67
|
return invokeFunc(Date.now());
|
|
67
68
|
}
|
|
@@ -69,7 +70,7 @@ function baseDebounce(func, wait, immediate, __throttle__) {
|
|
|
69
70
|
return result;
|
|
70
71
|
}
|
|
71
72
|
function pending() {
|
|
72
|
-
return timer !==
|
|
73
|
+
return timer !== nativeUndefined;
|
|
73
74
|
}
|
|
74
75
|
debounced.cancel = cancel;
|
|
75
76
|
debounced.flush = flush;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import isArray from '../isArray.js';
|
|
2
2
|
import isSymbol from '../isSymbol.js';
|
|
3
3
|
import createIteratee from './createIteratee.js';
|
|
4
|
+
import { nativeUndefined } from './native.js';
|
|
4
5
|
|
|
5
6
|
function createExtremum(array, comparator, iteratee) {
|
|
6
7
|
if (!isArray(array)) {
|
|
@@ -10,7 +11,7 @@ function createExtremum(array, comparator, iteratee) {
|
|
|
10
11
|
var internalIteratee = createIteratee(iteratee);
|
|
11
12
|
array.forEach(function (value) {
|
|
12
13
|
var current = internalIteratee(value);
|
|
13
|
-
if (current != null && (computed ===
|
|
14
|
+
if (current != null && (computed === nativeUndefined ? current === current && !isSymbol(current) : comparator(current, computed))) {
|
|
14
15
|
computed = current;
|
|
15
16
|
result = value;
|
|
16
17
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { dataViewTag, mapTag, promiseTag, setTag, weakMapTag, objectTag } from './native.js';
|
|
1
|
+
import { dataViewTag, mapTag, promiseTag, setTag, weakMapTag, stringUndefined, objectTag, nativeUndefined } from './native.js';
|
|
2
2
|
import { toSource } from './helpers.js';
|
|
3
3
|
import getTag from './getTag.js';
|
|
4
4
|
|
|
5
|
-
var dataViewExisted = typeof DataView !==
|
|
6
|
-
var mapExisted = typeof Map !==
|
|
7
|
-
var promiseExisted = typeof Promise !==
|
|
8
|
-
var setExisted = typeof Set !==
|
|
9
|
-
var weakMapExisted = typeof WeakMap !==
|
|
5
|
+
var dataViewExisted = typeof DataView !== stringUndefined;
|
|
6
|
+
var mapExisted = typeof Map !== stringUndefined;
|
|
7
|
+
var promiseExisted = typeof Promise !== stringUndefined;
|
|
8
|
+
var setExisted = typeof Set !== stringUndefined;
|
|
9
|
+
var weakMapExisted = typeof WeakMap !== stringUndefined;
|
|
10
10
|
var dataViewCtorString = toSource(DataView);
|
|
11
11
|
var mapCtorString = toSource(Map);
|
|
12
12
|
var promiseCtorString = toSource(Promise);
|
|
@@ -20,7 +20,7 @@ if ((dataViewExisted && getTag(new DataView(new ArrayBuffer(1))) !== dataViewTag
|
|
|
20
20
|
(weakMapExisted && getTag(new WeakMap()) !== weakMapTag)) {
|
|
21
21
|
getTagWithBugfix = function (value) {
|
|
22
22
|
var result = getTag(value);
|
|
23
|
-
var Ctor = result === objectTag ? value.constructor :
|
|
23
|
+
var Ctor = result === objectTag ? value.constructor : nativeUndefined;
|
|
24
24
|
var ctorString = Ctor ? toSource(Ctor) : '';
|
|
25
25
|
if (ctorString) {
|
|
26
26
|
switch (ctorString) {
|
package/es/internals/helpers.js
CHANGED
|
@@ -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.8.
|
|
4
|
+
var VERSION = "1.8.1";
|
|
5
5
|
var supportedArgumentsType = getTag((function () { return arguments; })()) === argumentsTag;
|
|
6
6
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
7
7
|
function toSource(func) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import allKeys from '../allKeys.js';
|
|
2
2
|
import eq from '../eq.js';
|
|
3
3
|
import getTagWithBugfix from './getTagWithBugfix.js';
|
|
4
|
-
import { symbolProto, arrayBufferTag, dataViewTag, errorTag, symbolTag, regExpTag, stringTag, dateTag, booleanTag, numberTag, objectTag, objectProtoHasOwnProperty, argumentsTag, setTag, mapTag, arrayTag, arrayProtoSlice } from './native.js';
|
|
4
|
+
import { symbolProto, nativeUndefined, arrayBufferTag, dataViewTag, errorTag, symbolTag, regExpTag, stringTag, dateTag, booleanTag, numberTag, objectTag, objectProtoHasOwnProperty, argumentsTag, setTag, mapTag, arrayTag, arrayProtoSlice } from './native.js';
|
|
5
5
|
import isBuffer from '../isBuffer.js';
|
|
6
6
|
import isFunction from '../isFunction.js';
|
|
7
7
|
import isNil from '../isNil.js';
|
|
@@ -9,7 +9,7 @@ import isObjectLike from '../isObjectLike.js';
|
|
|
9
9
|
import isTypedArray from '../isTypedArray.js';
|
|
10
10
|
import orderBy from '../orderBy.js';
|
|
11
11
|
|
|
12
|
-
var symbolValueOf = symbolProto ? symbolProto.valueOf :
|
|
12
|
+
var symbolValueOf = symbolProto ? symbolProto.valueOf : nativeUndefined;
|
|
13
13
|
function mapToArray(map) {
|
|
14
14
|
var result = [];
|
|
15
15
|
map.forEach(function (value, key) {
|
|
@@ -122,7 +122,7 @@ function isEqualDeep(value, other, customizer, strictCheck, valueStack, otherSta
|
|
|
122
122
|
while (length--) {
|
|
123
123
|
if (hasCustomizer) {
|
|
124
124
|
var compared = customizer(value[length], other[length], length, value, other, valueStack, otherStack);
|
|
125
|
-
if (compared !==
|
|
125
|
+
if (compared !== nativeUndefined) {
|
|
126
126
|
if (!compared) {
|
|
127
127
|
return false;
|
|
128
128
|
}
|
|
@@ -145,7 +145,7 @@ function isEqualDeep(value, other, customizer, strictCheck, valueStack, otherSta
|
|
|
145
145
|
var key = keys[length];
|
|
146
146
|
if (hasCustomizer) {
|
|
147
147
|
var compared = customizer(value[key], other[key], key, value, other, valueStack, otherStack);
|
|
148
|
-
if (compared !==
|
|
148
|
+
if (compared !== nativeUndefined) {
|
|
149
149
|
if (!compared) {
|
|
150
150
|
return false;
|
|
151
151
|
}
|
package/es/internals/native.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
var nativeUndefined = void 0;
|
|
2
|
+
var stringUndefined = 'undefined';
|
|
3
|
+
var stringObject = 'object';
|
|
1
4
|
var objectProto = Object.prototype;
|
|
2
5
|
var objectProtoToString = objectProto.toString;
|
|
3
6
|
var objectProtoHasOwnProperty = objectProto.hasOwnProperty;
|
|
@@ -7,8 +10,8 @@ var objectGetPrototypeOf = Object.getPrototypeOf;
|
|
|
7
10
|
var objectKeys = Object.keys;
|
|
8
11
|
var functionProto = Function.prototype;
|
|
9
12
|
var functionProtoToString = functionProto.toString;
|
|
10
|
-
var symbolExisted = typeof Symbol !==
|
|
11
|
-
var symbolProto = symbolExisted ? Symbol.prototype :
|
|
13
|
+
var symbolExisted = typeof Symbol !== stringUndefined;
|
|
14
|
+
var symbolProto = symbolExisted ? Symbol.prototype : nativeUndefined;
|
|
12
15
|
var arrayProto = Array.prototype;
|
|
13
16
|
var arrayProtoSlice = arrayProto.slice;
|
|
14
17
|
var mathMin = Math.min;
|
|
@@ -20,9 +23,9 @@ var mathAbs = Math.abs;
|
|
|
20
23
|
var numberIsFinite = Number.isFinite;
|
|
21
24
|
var numberIsInteger = Number.isInteger;
|
|
22
25
|
var numberIsSafeInteger = Number.isSafeInteger;
|
|
23
|
-
var globalThisExisted = typeof globalThis ===
|
|
24
|
-
var globalExisted = typeof global ===
|
|
25
|
-
var selfExisted = typeof self ===
|
|
26
|
+
var globalThisExisted = typeof globalThis === stringObject && globalThis;
|
|
27
|
+
var globalExisted = typeof global === stringObject && global;
|
|
28
|
+
var selfExisted = typeof self === stringObject && self;
|
|
26
29
|
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
27
30
|
var MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991;
|
|
28
31
|
var MAX_ARRAY_LENGTH = 4294967295;
|
|
@@ -49,4 +52,4 @@ var promiseTag = '[object Promise]';
|
|
|
49
52
|
var setTag = '[object Set]';
|
|
50
53
|
var weakMapTag = '[object WeakMap]';
|
|
51
54
|
|
|
52
|
-
export { MAX_ARRAY_LENGTH, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER, argumentsTag, arrayBufferTag, arrayProto, arrayProtoSlice, arrayTag, bigIntTag, blobTag, booleanTag, dataViewTag, dateTag, domExceptionTag, errorTag, functionProto, functionProtoToString, functionTags, globalExisted, globalThisExisted, mapTag, mathAbs, mathCeil, mathFloor, mathMax, mathMin, mathRandom, numberIsFinite, numberIsInteger, numberIsSafeInteger, numberTag, objectGetOwnPropertySymbols, objectGetPrototypeOf, objectKeys, objectProto, objectProtoHasOwnProperty, objectProtoPropertyIsEnumerable, objectProtoToString, objectTag, promiseTag, regExpTag, selfExisted, setTag, stringTag, symbolProto, symbolTag, typedArrayTags, weakMapTag, weakSetTag };
|
|
55
|
+
export { MAX_ARRAY_LENGTH, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER, argumentsTag, arrayBufferTag, arrayProto, arrayProtoSlice, arrayTag, bigIntTag, blobTag, booleanTag, dataViewTag, dateTag, domExceptionTag, errorTag, functionProto, functionProtoToString, functionTags, globalExisted, globalThisExisted, mapTag, mathAbs, mathCeil, mathFloor, mathMax, mathMin, mathRandom, nativeUndefined, numberIsFinite, numberIsInteger, numberIsSafeInteger, numberTag, objectGetOwnPropertySymbols, objectGetPrototypeOf, objectKeys, objectProto, objectProtoHasOwnProperty, objectProtoPropertyIsEnumerable, objectProtoToString, objectTag, promiseTag, regExpTag, selfExisted, setTag, stringObject, stringTag, stringUndefined, symbolProto, symbolTag, typedArrayTags, weakMapTag, weakSetTag };
|
package/es/internals/nodeUtil.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { stringObject } from './native.js';
|
|
2
|
+
|
|
3
|
+
var freeExports = typeof exports === stringObject && exports && !exports.nodeType && exports;
|
|
4
|
+
var freeModule = freeExports && typeof module === stringObject && module && !module.nodeType && module;
|
|
3
5
|
var nodeUtil = (function () {
|
|
4
6
|
try {
|
|
5
7
|
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
package/es/isBlob.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import getTag from './internals/getTag.js';
|
|
2
|
-
import { blobTag } from './internals/native.js';
|
|
2
|
+
import { blobTag, stringUndefined } from './internals/native.js';
|
|
3
3
|
|
|
4
|
-
var blobExisted = typeof Blob !==
|
|
4
|
+
var blobExisted = typeof Blob !== stringUndefined;
|
|
5
5
|
function isBlob(value) {
|
|
6
6
|
if (blobExisted && value instanceof Blob) {
|
|
7
7
|
return true;
|
package/es/isEqual.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import isEqualDeep from './internals/isEqualDeep.js';
|
|
2
|
+
import { nativeUndefined } from './internals/native.js';
|
|
2
3
|
|
|
3
4
|
function isEqual(value, other, customizer, strictCheck) {
|
|
4
5
|
if (strictCheck === void 0) { strictCheck = false; }
|
|
5
6
|
if (typeof customizer === 'function') {
|
|
6
7
|
var result = customizer(value, other);
|
|
7
|
-
if (result !==
|
|
8
|
+
if (result !== nativeUndefined) {
|
|
8
9
|
return !!result;
|
|
9
10
|
}
|
|
10
11
|
}
|
package/es/isMatch.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import allKeys from './allKeys.js';
|
|
2
2
|
import getTag from './internals/getTag.js';
|
|
3
|
-
import { objectTag } from './internals/native.js';
|
|
3
|
+
import { nativeUndefined, objectTag } from './internals/native.js';
|
|
4
4
|
import isEqualDeep from './internals/isEqualDeep.js';
|
|
5
5
|
|
|
6
6
|
function isDeepComparable(object, source) {
|
|
@@ -28,7 +28,7 @@ function baseIsMatch(object, source, customizer, strictCheck, objStack, srcStack
|
|
|
28
28
|
}
|
|
29
29
|
if (hasCustomizer) {
|
|
30
30
|
var compared = customizer(object[key], source[key], key, object, source, objStack, srcStack);
|
|
31
|
-
if (compared !==
|
|
31
|
+
if (compared !== nativeUndefined) {
|
|
32
32
|
if (!compared) {
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
@@ -46,7 +46,7 @@ function baseIsMatch(object, source, customizer, strictCheck, objStack, srcStack
|
|
|
46
46
|
var result = isEqualDeep(object, source, function (objValue, srcValue, k, obj, src) {
|
|
47
47
|
if (hasCustomizer) {
|
|
48
48
|
var compared = customizer(objValue, srcValue, k, obj, src, objStack, srcStack);
|
|
49
|
-
if (compared !==
|
|
49
|
+
if (compared !== nativeUndefined) {
|
|
50
50
|
return compared;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -60,11 +60,11 @@ function isMatch(object, source, customizer, strictCheck) {
|
|
|
60
60
|
if (strictCheck === void 0) { strictCheck = false; }
|
|
61
61
|
if (typeof customizer === 'function') {
|
|
62
62
|
var compared = customizer(object, source);
|
|
63
|
-
if (compared !==
|
|
63
|
+
if (compared !== nativeUndefined) {
|
|
64
64
|
return !!compared;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
return baseIsMatch(object, source, customizer, strictCheck,
|
|
67
|
+
return baseIsMatch(object, source, customizer, strictCheck, nativeUndefined, nativeUndefined);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export { isMatch as default };
|
package/es/isUndefined.js
CHANGED
package/es/merge.js
CHANGED
|
@@ -3,6 +3,7 @@ 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
|
+
import { nativeUndefined } from './internals/native.js';
|
|
6
7
|
|
|
7
8
|
function baseMerge(object, source, getKeys, customizer, stack) {
|
|
8
9
|
if (stack === void 0) { stack = new WeakMap(); }
|
|
@@ -19,8 +20,8 @@ function baseMerge(object, source, getKeys, customizer, stack) {
|
|
|
19
20
|
obj[key] = srcValue;
|
|
20
21
|
}
|
|
21
22
|
else {
|
|
22
|
-
var newValue = hasCustomizer ? customizer(obj[key], srcValue, key, obj, source) :
|
|
23
|
-
if (newValue !==
|
|
23
|
+
var newValue = hasCustomizer ? customizer(obj[key], srcValue, key, obj, source) : nativeUndefined;
|
|
24
|
+
if (newValue !== nativeUndefined) {
|
|
24
25
|
obj[key] = newValue;
|
|
25
26
|
}
|
|
26
27
|
else {
|
|
@@ -38,7 +39,7 @@ function baseMerge(object, source, getKeys, customizer, stack) {
|
|
|
38
39
|
if (newObjValue) {
|
|
39
40
|
obj[key] = baseMerge(newObjValue, srcValue, getKeys, customizer, stack);
|
|
40
41
|
}
|
|
41
|
-
else if (srcValue !==
|
|
42
|
+
else if (srcValue !== nativeUndefined || !(key in obj)) {
|
|
42
43
|
obj[key] = srcValue;
|
|
43
44
|
}
|
|
44
45
|
}
|
package/es/nth.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { nativeUndefined } from './internals/native.js';
|
|
1
2
|
import isArrayLike from './isArrayLike.js';
|
|
2
3
|
|
|
3
4
|
function nth(array, n) {
|
|
4
5
|
if (n === void 0) { n = 0; }
|
|
5
6
|
if (!isArrayLike(array)) {
|
|
6
|
-
return
|
|
7
|
+
return nativeUndefined;
|
|
7
8
|
}
|
|
8
9
|
n += n < 0 ? array.length : 0;
|
|
9
10
|
return array[n];
|
package/es/orderBy.js
CHANGED
|
@@ -3,11 +3,12 @@ import createIteratee from './internals/createIteratee.js';
|
|
|
3
3
|
import { compareMultiple } from './internals/compare.js';
|
|
4
4
|
import isArray from './isArray.js';
|
|
5
5
|
import forEach from './forEach.js';
|
|
6
|
+
import { nativeUndefined } from './internals/native.js';
|
|
6
7
|
|
|
7
8
|
var orderBy = function (collection, iteratees, orders) {
|
|
8
9
|
var result = [];
|
|
9
|
-
iteratees = (isArray(iteratees) ? iteratees : iteratees !==
|
|
10
|
-
orders = (isArray(orders) ? orders : orders !==
|
|
10
|
+
iteratees = (isArray(iteratees) ? iteratees : iteratees !== nativeUndefined ? [iteratees] : [identity]);
|
|
11
|
+
orders = (isArray(orders) ? orders : orders !== nativeUndefined ? [orders] : []);
|
|
11
12
|
var index = -1;
|
|
12
13
|
forEach(collection, function (item) {
|
|
13
14
|
var criteria = iteratees.map(function (iteratee) { return createIteratee(iteratee)(item); });
|
package/es/toString.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { symbolProto } from './internals/native.js';
|
|
1
|
+
import { symbolProto, nativeUndefined } from './internals/native.js';
|
|
2
2
|
import isArray from './isArray.js';
|
|
3
3
|
import isNil from './isNil.js';
|
|
4
4
|
import isSymbol from './isSymbol.js';
|
|
5
5
|
|
|
6
|
-
var symbolToString = symbolProto ? symbolProto.toString :
|
|
6
|
+
var symbolToString = symbolProto ? symbolProto.toString : nativeUndefined;
|
|
7
7
|
function baseToString(value) {
|
|
8
8
|
if (typeof value === 'string') {
|
|
9
9
|
return value;
|
package/lib/before.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var defaultTo = require('./defaultTo.js');
|
|
4
4
|
var helpers = require('./internals/helpers.js');
|
|
5
|
+
var native = require('./internals/native.js');
|
|
5
6
|
var toNumber = require('./toNumber.js');
|
|
6
7
|
|
|
7
8
|
function before(n, func) {
|
|
@@ -15,7 +16,7 @@ function before(n, func) {
|
|
|
15
16
|
result = func.apply(this, arguments);
|
|
16
17
|
}
|
|
17
18
|
if (n <= 1) {
|
|
18
|
-
func =
|
|
19
|
+
func = native.nativeUndefined;
|
|
19
20
|
}
|
|
20
21
|
return result;
|
|
21
22
|
};
|
package/lib/clamp.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var defaultTo = require('./defaultTo.js');
|
|
4
|
+
var native = require('./internals/native.js');
|
|
4
5
|
var toNumber = require('./toNumber.js');
|
|
5
6
|
|
|
6
7
|
var clamp = function (number, lower, upper) {
|
|
7
|
-
if (upper ===
|
|
8
|
+
if (upper === native.nativeUndefined) {
|
|
8
9
|
upper = lower;
|
|
9
|
-
lower =
|
|
10
|
+
lower = native.nativeUndefined;
|
|
10
11
|
}
|
|
11
|
-
if (upper !==
|
|
12
|
+
if (upper !== native.nativeUndefined) {
|
|
12
13
|
upper = defaultTo(toNumber(upper), 0);
|
|
13
14
|
}
|
|
14
|
-
if (lower !==
|
|
15
|
+
if (lower !== native.nativeUndefined) {
|
|
15
16
|
lower = defaultTo(toNumber(lower), 0);
|
|
16
17
|
}
|
|
17
18
|
number = toNumber(number);
|
|
18
19
|
if (number === number) {
|
|
19
|
-
if (upper !==
|
|
20
|
+
if (upper !== native.nativeUndefined) {
|
|
20
21
|
number = number <= upper ? number : upper;
|
|
21
22
|
}
|
|
22
|
-
if (lower !==
|
|
23
|
+
if (lower !== native.nativeUndefined) {
|
|
23
24
|
number = number >= lower ? number : lower;
|
|
24
25
|
}
|
|
25
26
|
}
|
package/lib/conformsTo.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var allKeys = require('./allKeys.js');
|
|
4
|
+
var native = require('./internals/native.js');
|
|
4
5
|
var isNil = require('./isNil.js');
|
|
5
6
|
|
|
6
7
|
var conformsTo = function (object, source) {
|
|
@@ -16,7 +17,7 @@ var conformsTo = function (object, source) {
|
|
|
16
17
|
var key = props[i];
|
|
17
18
|
var predicate = source[key];
|
|
18
19
|
var value = object[key];
|
|
19
|
-
if ((value ===
|
|
20
|
+
if ((value === native.nativeUndefined && !(key in object)) || !predicate(value)) {
|
|
20
21
|
return false;
|
|
21
22
|
}
|
|
22
23
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var defaultTo = require('../defaultTo.js');
|
|
4
4
|
var toNumber = require('../toNumber.js');
|
|
5
5
|
var helpers = require('./helpers.js');
|
|
6
|
+
var native = require('./native.js');
|
|
6
7
|
|
|
7
8
|
function baseDebounce(func, wait, immediate, __throttle__) {
|
|
8
9
|
if (__throttle__ === void 0) { __throttle__ = false; }
|
|
@@ -12,7 +13,7 @@ function baseDebounce(func, wait, immediate, __throttle__) {
|
|
|
12
13
|
var timer, lastCallTime, lastInvokeTime, lastArgs, lastThis, result;
|
|
13
14
|
wait = defaultTo(toNumber(wait), 0);
|
|
14
15
|
function shouldInvoke(time) {
|
|
15
|
-
if (lastCallTime ===
|
|
16
|
+
if (lastCallTime === native.nativeUndefined) {
|
|
16
17
|
return true;
|
|
17
18
|
}
|
|
18
19
|
var timeSinceLastCall = time - lastCallTime;
|
|
@@ -22,7 +23,7 @@ function baseDebounce(func, wait, immediate, __throttle__) {
|
|
|
22
23
|
function invokeFunc(time) {
|
|
23
24
|
lastInvokeTime = time;
|
|
24
25
|
result = func.apply(lastThis, lastArgs);
|
|
25
|
-
lastThis = lastArgs =
|
|
26
|
+
lastThis = lastArgs = native.nativeUndefined;
|
|
26
27
|
return result;
|
|
27
28
|
}
|
|
28
29
|
function debounced() {
|
|
@@ -34,36 +35,36 @@ function baseDebounce(func, wait, immediate, __throttle__) {
|
|
|
34
35
|
lastArgs = args;
|
|
35
36
|
var time = Date.now();
|
|
36
37
|
var isInvoke = shouldInvoke(time);
|
|
37
|
-
var waitTime = !__throttle__ ? wait : !isInvoke && lastCallTime !==
|
|
38
|
+
var waitTime = !__throttle__ ? wait : !isInvoke && lastCallTime !== native.nativeUndefined && timer === native.nativeUndefined ? wait - (time - lastCallTime) : wait;
|
|
38
39
|
lastCallTime = time;
|
|
39
40
|
if (isInvoke) {
|
|
40
|
-
if (immediate && timer ===
|
|
41
|
+
if (immediate && timer === native.nativeUndefined) {
|
|
41
42
|
return invokeFunc(time);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
if (timer !==
|
|
45
|
+
if (timer !== native.nativeUndefined && !__throttle__) {
|
|
45
46
|
clearTimeout(timer);
|
|
46
|
-
timer =
|
|
47
|
+
timer = native.nativeUndefined;
|
|
47
48
|
}
|
|
48
|
-
if (timer ===
|
|
49
|
+
if (timer === native.nativeUndefined) {
|
|
49
50
|
timer = setTimeout(function () {
|
|
50
|
-
timer =
|
|
51
|
+
timer = native.nativeUndefined;
|
|
51
52
|
invokeFunc(Date.now());
|
|
52
53
|
}, waitTime);
|
|
53
54
|
}
|
|
54
55
|
return result;
|
|
55
56
|
}
|
|
56
57
|
function cancel() {
|
|
57
|
-
if (timer !==
|
|
58
|
+
if (timer !== native.nativeUndefined) {
|
|
58
59
|
clearTimeout(timer);
|
|
59
|
-
timer =
|
|
60
|
+
timer = native.nativeUndefined;
|
|
60
61
|
}
|
|
61
|
-
lastCallTime = timer = lastArgs = lastThis =
|
|
62
|
+
lastCallTime = timer = lastArgs = lastThis = native.nativeUndefined;
|
|
62
63
|
}
|
|
63
64
|
function flush() {
|
|
64
|
-
if (timer !==
|
|
65
|
+
if (timer !== native.nativeUndefined) {
|
|
65
66
|
clearTimeout(timer);
|
|
66
|
-
timer =
|
|
67
|
+
timer = native.nativeUndefined;
|
|
67
68
|
if (lastArgs) {
|
|
68
69
|
return invokeFunc(Date.now());
|
|
69
70
|
}
|
|
@@ -71,7 +72,7 @@ function baseDebounce(func, wait, immediate, __throttle__) {
|
|
|
71
72
|
return result;
|
|
72
73
|
}
|
|
73
74
|
function pending() {
|
|
74
|
-
return timer !==
|
|
75
|
+
return timer !== native.nativeUndefined;
|
|
75
76
|
}
|
|
76
77
|
debounced.cancel = cancel;
|
|
77
78
|
debounced.flush = flush;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var isArray = require('../isArray.js');
|
|
4
4
|
var isSymbol = require('../isSymbol.js');
|
|
5
5
|
var createIteratee = require('./createIteratee.js');
|
|
6
|
+
var native = require('./native.js');
|
|
6
7
|
|
|
7
8
|
function createExtremum(array, comparator, iteratee) {
|
|
8
9
|
if (!isArray(array)) {
|
|
@@ -12,7 +13,7 @@ function createExtremum(array, comparator, iteratee) {
|
|
|
12
13
|
var internalIteratee = createIteratee(iteratee);
|
|
13
14
|
array.forEach(function (value) {
|
|
14
15
|
var current = internalIteratee(value);
|
|
15
|
-
if (current != null && (computed ===
|
|
16
|
+
if (current != null && (computed === native.nativeUndefined ? current === current && !isSymbol(current) : comparator(current, computed))) {
|
|
16
17
|
computed = current;
|
|
17
18
|
result = value;
|
|
18
19
|
}
|
|
@@ -4,11 +4,11 @@ var native = require('./native.js');
|
|
|
4
4
|
var helpers = require('./helpers.js');
|
|
5
5
|
var getTag = require('./getTag.js');
|
|
6
6
|
|
|
7
|
-
var dataViewExisted = typeof DataView !==
|
|
8
|
-
var mapExisted = typeof Map !==
|
|
9
|
-
var promiseExisted = typeof Promise !==
|
|
10
|
-
var setExisted = typeof Set !==
|
|
11
|
-
var weakMapExisted = typeof WeakMap !==
|
|
7
|
+
var dataViewExisted = typeof DataView !== native.stringUndefined;
|
|
8
|
+
var mapExisted = typeof Map !== native.stringUndefined;
|
|
9
|
+
var promiseExisted = typeof Promise !== native.stringUndefined;
|
|
10
|
+
var setExisted = typeof Set !== native.stringUndefined;
|
|
11
|
+
var weakMapExisted = typeof WeakMap !== native.stringUndefined;
|
|
12
12
|
var dataViewCtorString = helpers.toSource(DataView);
|
|
13
13
|
var mapCtorString = helpers.toSource(Map);
|
|
14
14
|
var promiseCtorString = helpers.toSource(Promise);
|
|
@@ -22,7 +22,7 @@ if ((dataViewExisted && getTag(new DataView(new ArrayBuffer(1))) !== native.data
|
|
|
22
22
|
(weakMapExisted && getTag(new WeakMap()) !== native.weakMapTag)) {
|
|
23
23
|
getTagWithBugfix = function (value) {
|
|
24
24
|
var result = getTag(value);
|
|
25
|
-
var Ctor = result === native.objectTag ? value.constructor :
|
|
25
|
+
var Ctor = result === native.objectTag ? value.constructor : native.nativeUndefined;
|
|
26
26
|
var ctorString = Ctor ? helpers.toSource(Ctor) : '';
|
|
27
27
|
if (ctorString) {
|
|
28
28
|
switch (ctorString) {
|
package/lib/internals/helpers.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var getTag = require('./getTag.js');
|
|
4
4
|
var native = require('./native.js');
|
|
5
5
|
|
|
6
|
-
exports.VERSION = "1.8.
|
|
6
|
+
exports.VERSION = "1.8.1";
|
|
7
7
|
exports.supportedArgumentsType = getTag((function () { return arguments; })()) === native.argumentsTag;
|
|
8
8
|
exports.FUNC_ERROR_TEXT = 'Expected a function';
|
|
9
9
|
function toSource(func) {
|