@goatlab/fluent 0.9.9 → 0.9.11
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/BaseConnector.d.ts +4 -4
- package/dist/BaseConnector.js +47 -27
- package/dist/BaseConnector.js.map +1 -1
- package/dist/Fluent.d.ts +7 -9
- package/dist/Fluent.js +36 -18
- package/dist/Fluent.js.map +1 -1
- package/dist/TypeOrmConnector/TypeOrmConnector.d.ts +10 -7
- package/dist/TypeOrmConnector/TypeOrmConnector.js +157 -106
- package/dist/TypeOrmConnector/TypeOrmConnector.js.map +1 -1
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoBaseAggregations.d.ts +2 -2
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoBaseAggregations.js +14 -8
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoBaseAggregations.js.map +1 -1
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoFindAggregatedQuery.d.ts +2 -2
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoFindAggregatedQuery.js.map +1 -1
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoOrderBy.js.map +1 -1
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoWhere.d.ts +2 -2
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoWhere.js +99 -181
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoWhere.js.map +1 -1
- package/dist/TypeOrmConnector/queryBuilder/sql/getQueryBuilderWhere.d.ts +2 -2
- package/dist/TypeOrmConnector/queryBuilder/sql/getQueryBuilderWhere.js +40 -40
- package/dist/TypeOrmConnector/queryBuilder/sql/getQueryBuilderWhere.js.map +1 -1
- package/dist/TypeOrmConnector/queryBuilder/sql/getTypeOrmWhere.d.ts +2 -2
- package/dist/TypeOrmConnector/queryBuilder/sql/getTypeOrmWhere.js +96 -41
- package/dist/TypeOrmConnector/queryBuilder/sql/getTypeOrmWhere.js.map +1 -1
- package/dist/TypeOrmConnector/test/advanced/typeOrm.entity.js +5 -1
- package/dist/TypeOrmConnector/test/advanced/typeOrm.entity.js.map +1 -1
- package/dist/TypeOrmConnector/test/basic/goat.entity.js +19 -7
- package/dist/TypeOrmConnector/test/basic/goat.entity.js.map +1 -1
- package/dist/TypeOrmConnector/util/clearEmpties.js +53 -33
- package/dist/TypeOrmConnector/util/clearEmpties.js.map +1 -1
- package/dist/TypeOrmConnector/util/extractConditions.d.ts +4 -2
- package/dist/TypeOrmConnector/util/extractConditions.js +109 -73
- package/dist/TypeOrmConnector/util/extractConditions.js.map +1 -1
- package/dist/TypeOrmConnector/util/extractInclude.js.map +1 -1
- package/dist/TypeOrmConnector/util/extractMetadataFromKeys.js +3 -1
- package/dist/TypeOrmConnector/util/extractMetadataFromKeys.js.map +1 -1
- package/dist/TypeOrmConnector/util/nestQueryResults.js +5 -3
- package/dist/TypeOrmConnector/util/nestQueryResults.js.map +1 -1
- package/dist/core/Loopback/build-schema.d.ts +1 -1
- package/dist/core/Loopback/build-schema.js +33 -27
- package/dist/core/Loopback/build-schema.js.map +1 -1
- package/dist/core/Loopback/common-types.d.ts +1 -3
- package/dist/core/Loopback/common-types.js.map +1 -1
- package/dist/core/Loopback/json-to-schema.js +6 -5
- package/dist/core/Loopback/json-to-schema.js.map +1 -1
- package/dist/core/Loopback/mapValues.js +704 -584
- package/dist/core/Loopback/model.d.ts +2 -3
- package/dist/core/Loopback/model.js +26 -18
- package/dist/core/Loopback/model.js.map +1 -1
- package/dist/core/Loopback/query.js +36 -30
- package/dist/core/Loopback/query.js.map +1 -1
- package/dist/core/Loopback/relation.types.d.ts +1 -1
- package/dist/core/Loopback/type-resolver.js +6 -3
- package/dist/core/Loopback/type-resolver.js.map +1 -1
- package/dist/core/Nestjs/applyDecorators.d.ts +1 -1
- package/dist/core/Nestjs/types/common.d.ts +7 -7
- package/dist/core/Nestjs/types/common.js +4 -4
- package/dist/core/Nestjs/types/decorators/api-hide-property.decorator.js +1 -1
- package/dist/core/Nestjs/types/decorators/api-hide-property.decorator.js.map +1 -1
- package/dist/core/Nestjs/types/decorators/api-property.decorator.js +1 -1
- package/dist/core/Nestjs/types/decorators/api-property.decorator.js.map +1 -1
- package/dist/core/Nestjs/types/decorators/apply-is-optional.decorator.d.ts +1 -1
- package/dist/core/Nestjs/types/decorators/apply-is-optional.decorator.js +1 -1
- package/dist/core/Nestjs/types/decorators/apply-is-optional.decorator.js.map +1 -1
- package/dist/core/Nestjs/types/decorators/args-type.decorator.js +4 -4
- package/dist/core/Nestjs/types/decorators/args-type.decorator.js.map +1 -1
- package/dist/core/Nestjs/types/decorators/create-property.decorator.d.ts +1 -1
- package/dist/core/Nestjs/types/decorators/create-property.decorator.js.map +1 -1
- package/dist/core/Nestjs/types/decorators/directive.decorator.js +1 -1
- package/dist/core/Nestjs/types/decorators/directive.decorator.js.map +1 -1
- package/dist/core/Nestjs/types/decorators/extensions.decorator.js.map +1 -1
- package/dist/core/Nestjs/types/decorators/field.decorator.d.ts +1 -1
- package/dist/core/Nestjs/types/decorators/field.decorator.js +3 -3
- package/dist/core/Nestjs/types/decorators/field.decorator.js.map +1 -1
- package/dist/core/Nestjs/types/decorators/input-type.decorator.js +3 -3
- package/dist/core/Nestjs/types/decorators/input-type.decorator.js.map +1 -1
- package/dist/core/Nestjs/types/decorators/interface-type.decorator.js +3 -3
- package/dist/core/Nestjs/types/decorators/interface-type.decorator.js.map +1 -1
- package/dist/core/Nestjs/types/decorators/partial-type.helper.js +1 -1
- package/dist/core/Nestjs/types/decorators/partial-type.helper.js.map +1 -1
- package/dist/core/Nestjs/types/interfaces/add-class-type-metadata.util.js.map +1 -1
- package/dist/core/Nestjs/types/interfaces/complexity.interface.d.ts +1 -1
- package/dist/core/Nestjs/types/interfaces/field-middleware.interface.d.ts +2 -4
- package/dist/core/Nestjs/types/interfaces/return-type-func.interface.d.ts +1 -1
- package/dist/core/Nestjs/types/interfaces/schema-object-metadata.interface.d.ts +2 -2
- package/dist/core/Nestjs/types/lazy-metadata.storage.d.ts +4 -4
- package/dist/core/Nestjs/types/lazy-metadata.storage.js +2 -3
- package/dist/core/Nestjs/types/lazy-metadata.storage.js.map +1 -1
- package/dist/core/Nestjs/types/metadata/class.metadata.d.ts +1 -1
- package/dist/core/Nestjs/types/metadata/directive.metadata.d.ts +1 -1
- package/dist/core/Nestjs/types/metadata/extensions.metadata.d.ts +1 -1
- package/dist/core/Nestjs/types/metadata/property.metadata.d.ts +2 -2
- package/dist/core/Nestjs/types/metadata/resolver.metadata.d.ts +6 -6
- package/dist/core/Nestjs/types/object-type.decorator.js +4 -4
- package/dist/core/Nestjs/types/object-type.decorator.js.map +1 -1
- package/dist/core/Nestjs/types/omit-type.d.ts +1 -1
- package/dist/core/Nestjs/types/omit-type.js +1 -1
- package/dist/core/Nestjs/types/omit-type.js.map +1 -1
- package/dist/core/Nestjs/types/reflection.utils.js.map +1 -1
- package/dist/core/Nestjs/types/set-metadata.decorator.js +1 -1
- package/dist/core/Nestjs/types/set-metadata.decorator.js.map +1 -1
- package/dist/core/Nestjs/types/type-metadata.storage.d.ts +4 -1
- package/dist/core/Nestjs/types/type-metadata.storage.js +45 -33
- package/dist/core/Nestjs/types/type-metadata.storage.js.map +1 -1
- package/dist/core/Nestjs/types/utils/enum.utils.js +2 -2
- package/dist/core/Nestjs/types/utils/enum.utils.js.map +1 -1
- package/dist/core/Nestjs/types/utils/get-fields-and-decorator.util.js +6 -6
- package/dist/core/Nestjs/types/utils/get-fields-and-decorator.util.js.map +1 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.js +5 -5
- package/dist/core/types.js.map +1 -1
- package/dist/decorators.d.ts +6 -6
- package/dist/decorators.js +10 -10
- package/dist/decorators.js.map +1 -1
- package/dist/index.d.ts +20 -16
- package/dist/index.js +29 -23
- package/dist/index.js.map +1 -1
- package/dist/loadRelations.d.ts +1 -1
- package/dist/loadRelations.js +129 -117
- package/dist/loadRelations.js.map +1 -1
- package/dist/outputKeys.js.map +1 -1
- package/dist/testing/genericUnifiedTestSuite.js +5 -6
- package/dist/testing/genericUnifiedTestSuite.js.map +1 -1
- package/dist/testing/unifiedTestFactory.d.ts +2 -2
- package/dist/testing/unifiedTestFactory.js +4 -7
- package/dist/testing/unifiedTestFactory.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +18 -18
- package/dist/types.js +16 -16
- package/dist/types.js.map +1 -1
- package/package.json +6 -6
|
@@ -8,119 +8,141 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/** Used as the size to enable large array optimizations. */
|
|
11
|
-
|
|
11
|
+
const LARGE_ARRAY_SIZE = 200
|
|
12
12
|
|
|
13
13
|
/** Used as the `TypeError` message for "Functions" methods. */
|
|
14
|
-
|
|
14
|
+
const FUNC_ERROR_TEXT = 'Expected a function'
|
|
15
15
|
|
|
16
16
|
/** Used to stand-in for `undefined` hash values. */
|
|
17
|
-
|
|
17
|
+
const HASH_UNDEFINED = '__lodash_hash_undefined__'
|
|
18
18
|
|
|
19
19
|
/** Used to compose bitmasks for comparison styles. */
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const UNORDERED_COMPARE_FLAG = 1
|
|
21
|
+
const PARTIAL_COMPARE_FLAG = 2
|
|
22
22
|
|
|
23
23
|
/** Used as references for various `Number` constants. */
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const INFINITY = 1 / 0
|
|
25
|
+
const MAX_SAFE_INTEGER = 9007199254740991
|
|
26
26
|
|
|
27
27
|
/** `Object#toString` result references. */
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
28
|
+
const argsTag = '[object Arguments]'
|
|
29
|
+
const arrayTag = '[object Array]'
|
|
30
|
+
const boolTag = '[object Boolean]'
|
|
31
|
+
const dateTag = '[object Date]'
|
|
32
|
+
const errorTag = '[object Error]'
|
|
33
|
+
const funcTag = '[object Function]'
|
|
34
|
+
const genTag = '[object GeneratorFunction]'
|
|
35
|
+
const mapTag = '[object Map]'
|
|
36
|
+
const numberTag = '[object Number]'
|
|
37
|
+
const objectTag = '[object Object]'
|
|
38
|
+
const promiseTag = '[object Promise]'
|
|
39
|
+
const regexpTag = '[object RegExp]'
|
|
40
|
+
const setTag = '[object Set]'
|
|
41
|
+
const stringTag = '[object String]'
|
|
42
|
+
const symbolTag = '[object Symbol]'
|
|
43
|
+
const weakMapTag = '[object WeakMap]'
|
|
44
|
+
|
|
45
|
+
const arrayBufferTag = '[object ArrayBuffer]'
|
|
46
|
+
const dataViewTag = '[object DataView]'
|
|
47
|
+
const float32Tag = '[object Float32Array]'
|
|
48
|
+
const float64Tag = '[object Float64Array]'
|
|
49
|
+
const int8Tag = '[object Int8Array]'
|
|
50
|
+
const int16Tag = '[object Int16Array]'
|
|
51
|
+
const int32Tag = '[object Int32Array]'
|
|
52
|
+
const uint8Tag = '[object Uint8Array]'
|
|
53
|
+
const uint8ClampedTag = '[object Uint8ClampedArray]'
|
|
54
|
+
const uint16Tag = '[object Uint16Array]'
|
|
55
|
+
const uint32Tag = '[object Uint32Array]'
|
|
56
56
|
|
|
57
57
|
/** Used to match property names within property paths. */
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/
|
|
59
|
+
const reIsPlainProp = /^\w*$/
|
|
60
|
+
const reLeadingDot = /^\./
|
|
61
|
+
const rePropName =
|
|
62
|
+
/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g
|
|
62
63
|
|
|
63
64
|
/**
|
|
64
65
|
* Used to match `RegExp`
|
|
65
66
|
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
66
67
|
*/
|
|
67
|
-
|
|
68
|
+
const reRegExpChar = /[\\^$.*+?()[\]{}|]/g
|
|
68
69
|
|
|
69
70
|
/** Used to match backslashes in property paths. */
|
|
70
|
-
|
|
71
|
+
const reEscapeChar = /\\(\\)?/g
|
|
71
72
|
|
|
72
73
|
/** Used to detect host constructors (Safari). */
|
|
73
|
-
|
|
74
|
+
const reIsHostCtor = /^\[object .+?Constructor\]$/
|
|
74
75
|
|
|
75
76
|
/** Used to detect unsigned integer values. */
|
|
76
|
-
|
|
77
|
+
const reIsUint = /^(?:0|[1-9]\d*)$/
|
|
77
78
|
|
|
78
79
|
/** Used to identify `toStringTag` values of typed arrays. */
|
|
79
|
-
|
|
80
|
-
typedArrayTags[float32Tag] =
|
|
81
|
-
typedArrayTags[
|
|
82
|
-
typedArrayTags[
|
|
83
|
-
typedArrayTags[
|
|
84
|
-
typedArrayTags[
|
|
85
|
-
typedArrayTags[
|
|
86
|
-
typedArrayTags[
|
|
87
|
-
typedArrayTags[
|
|
88
|
-
typedArrayTags[
|
|
89
|
-
|
|
90
|
-
typedArrayTags[
|
|
91
|
-
typedArrayTags[
|
|
92
|
-
typedArrayTags[
|
|
80
|
+
const typedArrayTags = {}
|
|
81
|
+
typedArrayTags[float32Tag] =
|
|
82
|
+
typedArrayTags[float64Tag] =
|
|
83
|
+
typedArrayTags[int8Tag] =
|
|
84
|
+
typedArrayTags[int16Tag] =
|
|
85
|
+
typedArrayTags[int32Tag] =
|
|
86
|
+
typedArrayTags[uint8Tag] =
|
|
87
|
+
typedArrayTags[uint8ClampedTag] =
|
|
88
|
+
typedArrayTags[uint16Tag] =
|
|
89
|
+
typedArrayTags[uint32Tag] =
|
|
90
|
+
true
|
|
91
|
+
typedArrayTags[argsTag] =
|
|
92
|
+
typedArrayTags[arrayTag] =
|
|
93
|
+
typedArrayTags[arrayBufferTag] =
|
|
94
|
+
typedArrayTags[boolTag] =
|
|
95
|
+
typedArrayTags[dataViewTag] =
|
|
96
|
+
typedArrayTags[dateTag] =
|
|
97
|
+
typedArrayTags[errorTag] =
|
|
98
|
+
typedArrayTags[funcTag] =
|
|
99
|
+
typedArrayTags[mapTag] =
|
|
100
|
+
typedArrayTags[numberTag] =
|
|
101
|
+
typedArrayTags[objectTag] =
|
|
102
|
+
typedArrayTags[regexpTag] =
|
|
103
|
+
typedArrayTags[setTag] =
|
|
104
|
+
typedArrayTags[stringTag] =
|
|
105
|
+
typedArrayTags[weakMapTag] =
|
|
106
|
+
false
|
|
93
107
|
|
|
94
108
|
/** Detect free variable `global` from Node.js. */
|
|
95
|
-
|
|
109
|
+
const freeGlobal =
|
|
110
|
+
typeof global === 'object' && global && global.Object === Object && global
|
|
96
111
|
|
|
97
112
|
/** Detect free variable `self`. */
|
|
98
|
-
|
|
113
|
+
const freeSelf =
|
|
114
|
+
typeof self === 'object' && self && self.Object === Object && self
|
|
99
115
|
|
|
100
116
|
/** Used as a reference to the global object. */
|
|
101
|
-
|
|
117
|
+
const root = freeGlobal || freeSelf || Function('return this')()
|
|
102
118
|
|
|
103
119
|
/** Detect free variable `exports`. */
|
|
104
|
-
|
|
120
|
+
const freeExports =
|
|
121
|
+
typeof exports === 'object' && exports && !exports.nodeType && exports
|
|
105
122
|
|
|
106
123
|
/** Detect free variable `module`. */
|
|
107
|
-
|
|
124
|
+
const freeModule =
|
|
125
|
+
freeExports &&
|
|
126
|
+
typeof module === 'object' &&
|
|
127
|
+
module &&
|
|
128
|
+
!module.nodeType &&
|
|
129
|
+
module
|
|
108
130
|
|
|
109
131
|
/** Detect the popular CommonJS extension `module.exports`. */
|
|
110
|
-
|
|
132
|
+
const moduleExports = freeModule && freeModule.exports === freeExports
|
|
111
133
|
|
|
112
134
|
/** Detect free variable `process` from Node.js. */
|
|
113
|
-
|
|
135
|
+
const freeProcess = moduleExports && freeGlobal.process
|
|
114
136
|
|
|
115
137
|
/** Used to access faster Node.js helpers. */
|
|
116
|
-
|
|
138
|
+
const nodeUtil = (() => {
|
|
117
139
|
try {
|
|
118
|
-
return freeProcess
|
|
119
|
-
} catch (
|
|
120
|
-
}()
|
|
140
|
+
return freeProcess?.binding('util')
|
|
141
|
+
} catch (_e) {}
|
|
142
|
+
})()
|
|
121
143
|
|
|
122
144
|
/* Node.js helper references. */
|
|
123
|
-
|
|
145
|
+
const nodeIsTypedArray = nodeUtil?.isTypedArray
|
|
124
146
|
|
|
125
147
|
/**
|
|
126
148
|
* A specialized version of `_.some` for arrays without support for iteratee
|
|
@@ -133,15 +155,15 @@ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
|
133
155
|
* else `false`.
|
|
134
156
|
*/
|
|
135
157
|
function arraySome(array, predicate) {
|
|
136
|
-
|
|
137
|
-
|
|
158
|
+
let index = -1
|
|
159
|
+
const length = array ? array.length : 0
|
|
138
160
|
|
|
139
161
|
while (++index < length) {
|
|
140
162
|
if (predicate(array[index], index, array)) {
|
|
141
|
-
return true
|
|
163
|
+
return true
|
|
142
164
|
}
|
|
143
165
|
}
|
|
144
|
-
return false
|
|
166
|
+
return false
|
|
145
167
|
}
|
|
146
168
|
|
|
147
169
|
/**
|
|
@@ -152,9 +174,7 @@ function arraySome(array, predicate) {
|
|
|
152
174
|
* @returns {Function} Returns the new accessor function.
|
|
153
175
|
*/
|
|
154
176
|
function baseProperty(key) {
|
|
155
|
-
return
|
|
156
|
-
return object == null ? undefined : object[key];
|
|
157
|
-
};
|
|
177
|
+
return object => (object == null ? undefined : object[key])
|
|
158
178
|
}
|
|
159
179
|
|
|
160
180
|
/**
|
|
@@ -167,13 +187,13 @@ function baseProperty(key) {
|
|
|
167
187
|
* @returns {Array} Returns the array of results.
|
|
168
188
|
*/
|
|
169
189
|
function baseTimes(n, iteratee) {
|
|
170
|
-
|
|
171
|
-
|
|
190
|
+
let index = -1
|
|
191
|
+
const result = Array(n)
|
|
172
192
|
|
|
173
193
|
while (++index < n) {
|
|
174
|
-
result[index] = iteratee(index)
|
|
194
|
+
result[index] = iteratee(index)
|
|
175
195
|
}
|
|
176
|
-
return result
|
|
196
|
+
return result
|
|
177
197
|
}
|
|
178
198
|
|
|
179
199
|
/**
|
|
@@ -184,9 +204,7 @@ function baseTimes(n, iteratee) {
|
|
|
184
204
|
* @returns {Function} Returns the new capped function.
|
|
185
205
|
*/
|
|
186
206
|
function baseUnary(func) {
|
|
187
|
-
return
|
|
188
|
-
return func(value);
|
|
189
|
-
};
|
|
207
|
+
return value => func(value)
|
|
190
208
|
}
|
|
191
209
|
|
|
192
210
|
/**
|
|
@@ -198,7 +216,7 @@ function baseUnary(func) {
|
|
|
198
216
|
* @returns {*} Returns the property value.
|
|
199
217
|
*/
|
|
200
218
|
function getValue(object, key) {
|
|
201
|
-
return object == null ? undefined : object[key]
|
|
219
|
+
return object == null ? undefined : object[key]
|
|
202
220
|
}
|
|
203
221
|
|
|
204
222
|
/**
|
|
@@ -211,13 +229,13 @@ function getValue(object, key) {
|
|
|
211
229
|
function isHostObject(value) {
|
|
212
230
|
// Many host objects are `Object` objects that can coerce to strings
|
|
213
231
|
// despite having improperly defined `toString` methods.
|
|
214
|
-
|
|
215
|
-
if (value != null && typeof value.toString
|
|
232
|
+
let result = false
|
|
233
|
+
if (value != null && typeof value.toString !== 'function') {
|
|
216
234
|
try {
|
|
217
|
-
result =
|
|
218
|
-
} catch (
|
|
235
|
+
result = !!`${value}`
|
|
236
|
+
} catch (_e) {}
|
|
219
237
|
}
|
|
220
|
-
return result
|
|
238
|
+
return result
|
|
221
239
|
}
|
|
222
240
|
|
|
223
241
|
/**
|
|
@@ -228,13 +246,13 @@ function isHostObject(value) {
|
|
|
228
246
|
* @returns {Array} Returns the key-value pairs.
|
|
229
247
|
*/
|
|
230
248
|
function mapToArray(map) {
|
|
231
|
-
|
|
232
|
-
|
|
249
|
+
let index = -1
|
|
250
|
+
const result = Array(map.size)
|
|
233
251
|
|
|
234
|
-
map.forEach(
|
|
235
|
-
result[++index] = [key, value]
|
|
236
|
-
})
|
|
237
|
-
return result
|
|
252
|
+
map.forEach((value, key) => {
|
|
253
|
+
result[++index] = [key, value]
|
|
254
|
+
})
|
|
255
|
+
return result
|
|
238
256
|
}
|
|
239
257
|
|
|
240
258
|
/**
|
|
@@ -246,9 +264,7 @@ function mapToArray(map) {
|
|
|
246
264
|
* @returns {Function} Returns the new function.
|
|
247
265
|
*/
|
|
248
266
|
function overArg(func, transform) {
|
|
249
|
-
return
|
|
250
|
-
return func(transform(arg));
|
|
251
|
-
};
|
|
267
|
+
return arg => func(transform(arg))
|
|
252
268
|
}
|
|
253
269
|
|
|
254
270
|
/**
|
|
@@ -259,76 +275,83 @@ function overArg(func, transform) {
|
|
|
259
275
|
* @returns {Array} Returns the values.
|
|
260
276
|
*/
|
|
261
277
|
function setToArray(set) {
|
|
262
|
-
|
|
263
|
-
|
|
278
|
+
let index = -1
|
|
279
|
+
const result = Array(set.size)
|
|
264
280
|
|
|
265
|
-
set.forEach(
|
|
266
|
-
result[++index] = value
|
|
267
|
-
})
|
|
268
|
-
return result
|
|
281
|
+
set.forEach(value => {
|
|
282
|
+
result[++index] = value
|
|
283
|
+
})
|
|
284
|
+
return result
|
|
269
285
|
}
|
|
270
286
|
|
|
271
287
|
/** Used for built-in method references. */
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
288
|
+
const arrayProto = Array.prototype
|
|
289
|
+
const funcProto = Function.prototype
|
|
290
|
+
const objectProto = Object.prototype
|
|
275
291
|
|
|
276
292
|
/** Used to detect overreaching core-js shims. */
|
|
277
|
-
|
|
293
|
+
const coreJsData = root['__core-js_shared__']
|
|
278
294
|
|
|
279
295
|
/** Used to detect methods masquerading as native. */
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
return uid ?
|
|
283
|
-
}()
|
|
296
|
+
const maskSrcKey = (() => {
|
|
297
|
+
const uid = /[^.]+$/.exec(coreJsData?.keys?.IE_PROTO || '')
|
|
298
|
+
return uid ? `Symbol(src)_1.${uid}` : ''
|
|
299
|
+
})()
|
|
284
300
|
|
|
285
301
|
/** Used to resolve the decompiled source of functions. */
|
|
286
|
-
|
|
302
|
+
const funcToString = funcProto.toString
|
|
287
303
|
|
|
288
304
|
/** Used to check objects for own properties. */
|
|
289
|
-
|
|
305
|
+
const hasOwnProperty = objectProto.hasOwnProperty
|
|
290
306
|
|
|
291
307
|
/**
|
|
292
308
|
* Used to resolve the
|
|
293
309
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
294
310
|
* of values.
|
|
295
311
|
*/
|
|
296
|
-
|
|
312
|
+
const objectToString = objectProto.toString
|
|
297
313
|
|
|
298
314
|
/** Used to detect if a method is native. */
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
)
|
|
315
|
+
const reIsNative = RegExp(
|
|
316
|
+
'^' +
|
|
317
|
+
funcToString
|
|
318
|
+
.call(hasOwnProperty)
|
|
319
|
+
.replace(reRegExpChar, '\\$&')
|
|
320
|
+
.replace(
|
|
321
|
+
/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,
|
|
322
|
+
'$1.*?'
|
|
323
|
+
) +
|
|
324
|
+
'$'
|
|
325
|
+
)
|
|
303
326
|
|
|
304
327
|
/** Built-in value references. */
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
328
|
+
const Symbol = root.Symbol
|
|
329
|
+
const Uint8Array = root.Uint8Array
|
|
330
|
+
const propertyIsEnumerable = objectProto.propertyIsEnumerable
|
|
331
|
+
const splice = arrayProto.splice
|
|
309
332
|
|
|
310
333
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
311
|
-
|
|
334
|
+
const nativeKeys = overArg(Object.keys, Object)
|
|
312
335
|
|
|
313
336
|
/* Built-in method references that are verified to be native. */
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
337
|
+
const DataView = getNative(root, 'DataView')
|
|
338
|
+
const Map = getNative(root, 'Map')
|
|
339
|
+
const Promise = getNative(root, 'Promise')
|
|
340
|
+
const Set = getNative(root, 'Set')
|
|
341
|
+
const WeakMap = getNative(root, 'WeakMap')
|
|
342
|
+
const nativeCreate = getNative(Object, 'create')
|
|
320
343
|
|
|
321
344
|
/** Used to detect maps, sets, and weakmaps. */
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
345
|
+
const dataViewCtorString = toSource(DataView)
|
|
346
|
+
const mapCtorString = toSource(Map)
|
|
347
|
+
const promiseCtorString = toSource(Promise)
|
|
348
|
+
const setCtorString = toSource(Set)
|
|
349
|
+
const weakMapCtorString = toSource(WeakMap)
|
|
327
350
|
|
|
328
351
|
/** Used to convert symbols to primitives and strings. */
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
352
|
+
const symbolProto = Symbol ? Symbol.prototype : undefined
|
|
353
|
+
const symbolValueOf = symbolProto ? symbolProto.valueOf : undefined
|
|
354
|
+
const symbolToString = symbolProto ? symbolProto.toString : undefined
|
|
332
355
|
|
|
333
356
|
/**
|
|
334
357
|
* Creates a hash object.
|
|
@@ -338,13 +361,13 @@ var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
|
338
361
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
339
362
|
*/
|
|
340
363
|
function Hash(entries) {
|
|
341
|
-
|
|
342
|
-
|
|
364
|
+
let index = -1
|
|
365
|
+
const length = entries ? entries.length : 0
|
|
343
366
|
|
|
344
|
-
this.clear()
|
|
367
|
+
this.clear()
|
|
345
368
|
while (++index < length) {
|
|
346
|
-
|
|
347
|
-
this.set(entry[0], entry[1])
|
|
369
|
+
const entry = entries[index]
|
|
370
|
+
this.set(entry[0], entry[1])
|
|
348
371
|
}
|
|
349
372
|
}
|
|
350
373
|
|
|
@@ -356,7 +379,7 @@ function Hash(entries) {
|
|
|
356
379
|
* @memberOf Hash
|
|
357
380
|
*/
|
|
358
381
|
function hashClear() {
|
|
359
|
-
this.__data__ = nativeCreate ? nativeCreate(null) : {}
|
|
382
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {}
|
|
360
383
|
}
|
|
361
384
|
|
|
362
385
|
/**
|
|
@@ -370,7 +393,7 @@ function hashClear() {
|
|
|
370
393
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
371
394
|
*/
|
|
372
395
|
function hashDelete(key) {
|
|
373
|
-
return this.has(key) && delete this.__data__[key]
|
|
396
|
+
return this.has(key) && delete this.__data__[key]
|
|
374
397
|
}
|
|
375
398
|
|
|
376
399
|
/**
|
|
@@ -383,12 +406,12 @@ function hashDelete(key) {
|
|
|
383
406
|
* @returns {*} Returns the entry value.
|
|
384
407
|
*/
|
|
385
408
|
function hashGet(key) {
|
|
386
|
-
|
|
409
|
+
const data = this.__data__
|
|
387
410
|
if (nativeCreate) {
|
|
388
|
-
|
|
389
|
-
return result === HASH_UNDEFINED ? undefined : result
|
|
411
|
+
const result = data[key]
|
|
412
|
+
return result === HASH_UNDEFINED ? undefined : result
|
|
390
413
|
}
|
|
391
|
-
return hasOwnProperty.call(data, key) ? data[key] : undefined
|
|
414
|
+
return hasOwnProperty.call(data, key) ? data[key] : undefined
|
|
392
415
|
}
|
|
393
416
|
|
|
394
417
|
/**
|
|
@@ -401,8 +424,8 @@ function hashGet(key) {
|
|
|
401
424
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
402
425
|
*/
|
|
403
426
|
function hashHas(key) {
|
|
404
|
-
|
|
405
|
-
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key)
|
|
427
|
+
const data = this.__data__
|
|
428
|
+
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key)
|
|
406
429
|
}
|
|
407
430
|
|
|
408
431
|
/**
|
|
@@ -416,17 +439,17 @@ function hashHas(key) {
|
|
|
416
439
|
* @returns {Object} Returns the hash instance.
|
|
417
440
|
*/
|
|
418
441
|
function hashSet(key, value) {
|
|
419
|
-
|
|
420
|
-
data[key] =
|
|
421
|
-
return this
|
|
442
|
+
const data = this.__data__
|
|
443
|
+
data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value
|
|
444
|
+
return this
|
|
422
445
|
}
|
|
423
446
|
|
|
424
447
|
// Add methods to `Hash`.
|
|
425
|
-
Hash.prototype.clear = hashClear
|
|
426
|
-
Hash.prototype
|
|
427
|
-
Hash.prototype.get = hashGet
|
|
428
|
-
Hash.prototype.has = hashHas
|
|
429
|
-
Hash.prototype.set = hashSet
|
|
448
|
+
Hash.prototype.clear = hashClear
|
|
449
|
+
Hash.prototype.delete = hashDelete
|
|
450
|
+
Hash.prototype.get = hashGet
|
|
451
|
+
Hash.prototype.has = hashHas
|
|
452
|
+
Hash.prototype.set = hashSet
|
|
430
453
|
|
|
431
454
|
/**
|
|
432
455
|
* Creates an list cache object.
|
|
@@ -436,13 +459,13 @@ Hash.prototype.set = hashSet;
|
|
|
436
459
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
437
460
|
*/
|
|
438
461
|
function ListCache(entries) {
|
|
439
|
-
|
|
440
|
-
|
|
462
|
+
let index = -1
|
|
463
|
+
const length = entries ? entries.length : 0
|
|
441
464
|
|
|
442
|
-
this.clear()
|
|
465
|
+
this.clear()
|
|
443
466
|
while (++index < length) {
|
|
444
|
-
|
|
445
|
-
this.set(entry[0], entry[1])
|
|
467
|
+
const entry = entries[index]
|
|
468
|
+
this.set(entry[0], entry[1])
|
|
446
469
|
}
|
|
447
470
|
}
|
|
448
471
|
|
|
@@ -454,7 +477,7 @@ function ListCache(entries) {
|
|
|
454
477
|
* @memberOf ListCache
|
|
455
478
|
*/
|
|
456
479
|
function listCacheClear() {
|
|
457
|
-
this.__data__ = []
|
|
480
|
+
this.__data__ = []
|
|
458
481
|
}
|
|
459
482
|
|
|
460
483
|
/**
|
|
@@ -467,19 +490,19 @@ function listCacheClear() {
|
|
|
467
490
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
468
491
|
*/
|
|
469
492
|
function listCacheDelete(key) {
|
|
470
|
-
|
|
471
|
-
|
|
493
|
+
const data = this.__data__
|
|
494
|
+
const index = assocIndexOf(data, key)
|
|
472
495
|
|
|
473
496
|
if (index < 0) {
|
|
474
|
-
return false
|
|
497
|
+
return false
|
|
475
498
|
}
|
|
476
|
-
|
|
477
|
-
if (index
|
|
478
|
-
data.pop()
|
|
499
|
+
const lastIndex = data.length - 1
|
|
500
|
+
if (index === lastIndex) {
|
|
501
|
+
data.pop()
|
|
479
502
|
} else {
|
|
480
|
-
splice.call(data, index, 1)
|
|
503
|
+
splice.call(data, index, 1)
|
|
481
504
|
}
|
|
482
|
-
return true
|
|
505
|
+
return true
|
|
483
506
|
}
|
|
484
507
|
|
|
485
508
|
/**
|
|
@@ -492,10 +515,10 @@ function listCacheDelete(key) {
|
|
|
492
515
|
* @returns {*} Returns the entry value.
|
|
493
516
|
*/
|
|
494
517
|
function listCacheGet(key) {
|
|
495
|
-
|
|
496
|
-
|
|
518
|
+
const data = this.__data__
|
|
519
|
+
const index = assocIndexOf(data, key)
|
|
497
520
|
|
|
498
|
-
return index < 0 ? undefined : data[index][1]
|
|
521
|
+
return index < 0 ? undefined : data[index][1]
|
|
499
522
|
}
|
|
500
523
|
|
|
501
524
|
/**
|
|
@@ -508,7 +531,7 @@ function listCacheGet(key) {
|
|
|
508
531
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
509
532
|
*/
|
|
510
533
|
function listCacheHas(key) {
|
|
511
|
-
return assocIndexOf(this.__data__, key) > -1
|
|
534
|
+
return assocIndexOf(this.__data__, key) > -1
|
|
512
535
|
}
|
|
513
536
|
|
|
514
537
|
/**
|
|
@@ -522,23 +545,23 @@ function listCacheHas(key) {
|
|
|
522
545
|
* @returns {Object} Returns the list cache instance.
|
|
523
546
|
*/
|
|
524
547
|
function listCacheSet(key, value) {
|
|
525
|
-
|
|
526
|
-
|
|
548
|
+
const data = this.__data__
|
|
549
|
+
const index = assocIndexOf(data, key)
|
|
527
550
|
|
|
528
551
|
if (index < 0) {
|
|
529
|
-
data.push([key, value])
|
|
552
|
+
data.push([key, value])
|
|
530
553
|
} else {
|
|
531
|
-
data[index][1] = value
|
|
554
|
+
data[index][1] = value
|
|
532
555
|
}
|
|
533
|
-
return this
|
|
556
|
+
return this
|
|
534
557
|
}
|
|
535
558
|
|
|
536
559
|
// Add methods to `ListCache`.
|
|
537
|
-
ListCache.prototype.clear = listCacheClear
|
|
538
|
-
ListCache.prototype
|
|
539
|
-
ListCache.prototype.get = listCacheGet
|
|
540
|
-
ListCache.prototype.has = listCacheHas
|
|
541
|
-
ListCache.prototype.set = listCacheSet
|
|
560
|
+
ListCache.prototype.clear = listCacheClear
|
|
561
|
+
ListCache.prototype.delete = listCacheDelete
|
|
562
|
+
ListCache.prototype.get = listCacheGet
|
|
563
|
+
ListCache.prototype.has = listCacheHas
|
|
564
|
+
ListCache.prototype.set = listCacheSet
|
|
542
565
|
|
|
543
566
|
/**
|
|
544
567
|
* Creates a map cache object to store key-value pairs.
|
|
@@ -548,13 +571,13 @@ ListCache.prototype.set = listCacheSet;
|
|
|
548
571
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
549
572
|
*/
|
|
550
573
|
function MapCache(entries) {
|
|
551
|
-
|
|
552
|
-
|
|
574
|
+
let index = -1
|
|
575
|
+
const length = entries ? entries.length : 0
|
|
553
576
|
|
|
554
|
-
this.clear()
|
|
577
|
+
this.clear()
|
|
555
578
|
while (++index < length) {
|
|
556
|
-
|
|
557
|
-
this.set(entry[0], entry[1])
|
|
579
|
+
const entry = entries[index]
|
|
580
|
+
this.set(entry[0], entry[1])
|
|
558
581
|
}
|
|
559
582
|
}
|
|
560
583
|
|
|
@@ -567,10 +590,10 @@ function MapCache(entries) {
|
|
|
567
590
|
*/
|
|
568
591
|
function mapCacheClear() {
|
|
569
592
|
this.__data__ = {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
}
|
|
593
|
+
hash: new Hash(),
|
|
594
|
+
map: new (Map || ListCache)(),
|
|
595
|
+
string: new Hash()
|
|
596
|
+
}
|
|
574
597
|
}
|
|
575
598
|
|
|
576
599
|
/**
|
|
@@ -583,7 +606,7 @@ function mapCacheClear() {
|
|
|
583
606
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
584
607
|
*/
|
|
585
608
|
function mapCacheDelete(key) {
|
|
586
|
-
return getMapData(this, key)
|
|
609
|
+
return getMapData(this, key).delete(key)
|
|
587
610
|
}
|
|
588
611
|
|
|
589
612
|
/**
|
|
@@ -596,7 +619,7 @@ function mapCacheDelete(key) {
|
|
|
596
619
|
* @returns {*} Returns the entry value.
|
|
597
620
|
*/
|
|
598
621
|
function mapCacheGet(key) {
|
|
599
|
-
return getMapData(this, key).get(key)
|
|
622
|
+
return getMapData(this, key).get(key)
|
|
600
623
|
}
|
|
601
624
|
|
|
602
625
|
/**
|
|
@@ -609,7 +632,7 @@ function mapCacheGet(key) {
|
|
|
609
632
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
610
633
|
*/
|
|
611
634
|
function mapCacheHas(key) {
|
|
612
|
-
return getMapData(this, key).has(key)
|
|
635
|
+
return getMapData(this, key).has(key)
|
|
613
636
|
}
|
|
614
637
|
|
|
615
638
|
/**
|
|
@@ -623,16 +646,16 @@ function mapCacheHas(key) {
|
|
|
623
646
|
* @returns {Object} Returns the map cache instance.
|
|
624
647
|
*/
|
|
625
648
|
function mapCacheSet(key, value) {
|
|
626
|
-
getMapData(this, key).set(key, value)
|
|
627
|
-
return this
|
|
649
|
+
getMapData(this, key).set(key, value)
|
|
650
|
+
return this
|
|
628
651
|
}
|
|
629
652
|
|
|
630
653
|
// Add methods to `MapCache`.
|
|
631
|
-
MapCache.prototype.clear = mapCacheClear
|
|
632
|
-
MapCache.prototype
|
|
633
|
-
MapCache.prototype.get = mapCacheGet
|
|
634
|
-
MapCache.prototype.has = mapCacheHas
|
|
635
|
-
MapCache.prototype.set = mapCacheSet
|
|
654
|
+
MapCache.prototype.clear = mapCacheClear
|
|
655
|
+
MapCache.prototype.delete = mapCacheDelete
|
|
656
|
+
MapCache.prototype.get = mapCacheGet
|
|
657
|
+
MapCache.prototype.has = mapCacheHas
|
|
658
|
+
MapCache.prototype.set = mapCacheSet
|
|
636
659
|
|
|
637
660
|
/**
|
|
638
661
|
*
|
|
@@ -643,12 +666,12 @@ MapCache.prototype.set = mapCacheSet;
|
|
|
643
666
|
* @param {Array} [values] The values to cache.
|
|
644
667
|
*/
|
|
645
668
|
function SetCache(values) {
|
|
646
|
-
|
|
647
|
-
|
|
669
|
+
let index = -1
|
|
670
|
+
const length = values ? values.length : 0
|
|
648
671
|
|
|
649
|
-
this.__data__ = new MapCache
|
|
672
|
+
this.__data__ = new MapCache()
|
|
650
673
|
while (++index < length) {
|
|
651
|
-
this.add(values[index])
|
|
674
|
+
this.add(values[index])
|
|
652
675
|
}
|
|
653
676
|
}
|
|
654
677
|
|
|
@@ -663,8 +686,8 @@ function SetCache(values) {
|
|
|
663
686
|
* @returns {Object} Returns the cache instance.
|
|
664
687
|
*/
|
|
665
688
|
function setCacheAdd(value) {
|
|
666
|
-
this.__data__.set(value, HASH_UNDEFINED)
|
|
667
|
-
return this
|
|
689
|
+
this.__data__.set(value, HASH_UNDEFINED)
|
|
690
|
+
return this
|
|
668
691
|
}
|
|
669
692
|
|
|
670
693
|
/**
|
|
@@ -677,12 +700,12 @@ function setCacheAdd(value) {
|
|
|
677
700
|
* @returns {number} Returns `true` if `value` is found, else `false`.
|
|
678
701
|
*/
|
|
679
702
|
function setCacheHas(value) {
|
|
680
|
-
return this.__data__.has(value)
|
|
703
|
+
return this.__data__.has(value)
|
|
681
704
|
}
|
|
682
705
|
|
|
683
706
|
// Add methods to `SetCache`.
|
|
684
|
-
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd
|
|
685
|
-
SetCache.prototype.has = setCacheHas
|
|
707
|
+
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd
|
|
708
|
+
SetCache.prototype.has = setCacheHas
|
|
686
709
|
|
|
687
710
|
/**
|
|
688
711
|
* Creates a stack cache object to store key-value pairs.
|
|
@@ -692,7 +715,7 @@ SetCache.prototype.has = setCacheHas;
|
|
|
692
715
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
693
716
|
*/
|
|
694
717
|
function Stack(entries) {
|
|
695
|
-
this.__data__ = new ListCache(entries)
|
|
718
|
+
this.__data__ = new ListCache(entries)
|
|
696
719
|
}
|
|
697
720
|
|
|
698
721
|
/**
|
|
@@ -703,7 +726,7 @@ function Stack(entries) {
|
|
|
703
726
|
* @memberOf Stack
|
|
704
727
|
*/
|
|
705
728
|
function stackClear() {
|
|
706
|
-
this.__data__ = new ListCache
|
|
729
|
+
this.__data__ = new ListCache()
|
|
707
730
|
}
|
|
708
731
|
|
|
709
732
|
/**
|
|
@@ -716,7 +739,7 @@ function stackClear() {
|
|
|
716
739
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
717
740
|
*/
|
|
718
741
|
function stackDelete(key) {
|
|
719
|
-
return this.__data__
|
|
742
|
+
return this.__data__.delete(key)
|
|
720
743
|
}
|
|
721
744
|
|
|
722
745
|
/**
|
|
@@ -729,7 +752,7 @@ function stackDelete(key) {
|
|
|
729
752
|
* @returns {*} Returns the entry value.
|
|
730
753
|
*/
|
|
731
754
|
function stackGet(key) {
|
|
732
|
-
return this.__data__.get(key)
|
|
755
|
+
return this.__data__.get(key)
|
|
733
756
|
}
|
|
734
757
|
|
|
735
758
|
/**
|
|
@@ -742,7 +765,7 @@ function stackGet(key) {
|
|
|
742
765
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
743
766
|
*/
|
|
744
767
|
function stackHas(key) {
|
|
745
|
-
return this.__data__.has(key)
|
|
768
|
+
return this.__data__.has(key)
|
|
746
769
|
}
|
|
747
770
|
|
|
748
771
|
/**
|
|
@@ -756,25 +779,25 @@ function stackHas(key) {
|
|
|
756
779
|
* @returns {Object} Returns the stack cache instance.
|
|
757
780
|
*/
|
|
758
781
|
function stackSet(key, value) {
|
|
759
|
-
|
|
782
|
+
let cache = this.__data__
|
|
760
783
|
if (cache instanceof ListCache) {
|
|
761
|
-
|
|
762
|
-
if (!Map ||
|
|
763
|
-
pairs.push([key, value])
|
|
764
|
-
return this
|
|
784
|
+
const pairs = cache.__data__
|
|
785
|
+
if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
786
|
+
pairs.push([key, value])
|
|
787
|
+
return this
|
|
765
788
|
}
|
|
766
|
-
cache = this.__data__ = new MapCache(pairs)
|
|
789
|
+
cache = this.__data__ = new MapCache(pairs)
|
|
767
790
|
}
|
|
768
|
-
cache.set(key, value)
|
|
769
|
-
return this
|
|
791
|
+
cache.set(key, value)
|
|
792
|
+
return this
|
|
770
793
|
}
|
|
771
794
|
|
|
772
795
|
// Add methods to `Stack`.
|
|
773
|
-
Stack.prototype.clear = stackClear
|
|
774
|
-
Stack.prototype
|
|
775
|
-
Stack.prototype.get = stackGet
|
|
776
|
-
Stack.prototype.has = stackHas
|
|
777
|
-
Stack.prototype.set = stackSet
|
|
796
|
+
Stack.prototype.clear = stackClear
|
|
797
|
+
Stack.prototype.delete = stackDelete
|
|
798
|
+
Stack.prototype.get = stackGet
|
|
799
|
+
Stack.prototype.has = stackHas
|
|
800
|
+
Stack.prototype.set = stackSet
|
|
778
801
|
|
|
779
802
|
/**
|
|
780
803
|
* Creates an array of the enumerable property names of the array-like `value`.
|
|
@@ -787,20 +810,21 @@ Stack.prototype.set = stackSet;
|
|
|
787
810
|
function arrayLikeKeys(value, inherited) {
|
|
788
811
|
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
|
789
812
|
// Safari 9 makes `arguments.length` enumerable in strict mode.
|
|
790
|
-
|
|
791
|
-
? baseTimes(value.length, String)
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
813
|
+
const result =
|
|
814
|
+
isArray(value) || isArguments(value) ? baseTimes(value.length, String) : []
|
|
815
|
+
|
|
816
|
+
const length = result.length
|
|
817
|
+
const skipIndexes = !!length
|
|
818
|
+
|
|
819
|
+
for (const key in value) {
|
|
820
|
+
if (
|
|
821
|
+
(inherited || hasOwnProperty.call(value, key)) &&
|
|
822
|
+
!(skipIndexes && (key === 'length' || isIndex(key, length)))
|
|
823
|
+
) {
|
|
824
|
+
result.push(key)
|
|
801
825
|
}
|
|
802
826
|
}
|
|
803
|
-
return result
|
|
827
|
+
return result
|
|
804
828
|
}
|
|
805
829
|
|
|
806
830
|
/**
|
|
@@ -812,13 +836,13 @@ function arrayLikeKeys(value, inherited) {
|
|
|
812
836
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
813
837
|
*/
|
|
814
838
|
function assocIndexOf(array, key) {
|
|
815
|
-
|
|
839
|
+
let length = array.length
|
|
816
840
|
while (length--) {
|
|
817
841
|
if (eq(array[length][0], key)) {
|
|
818
|
-
return length
|
|
842
|
+
return length
|
|
819
843
|
}
|
|
820
844
|
}
|
|
821
|
-
return -1
|
|
845
|
+
return -1
|
|
822
846
|
}
|
|
823
847
|
|
|
824
848
|
/**
|
|
@@ -832,7 +856,7 @@ function assocIndexOf(array, key) {
|
|
|
832
856
|
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
833
857
|
* @returns {Object} Returns `object`.
|
|
834
858
|
*/
|
|
835
|
-
|
|
859
|
+
const baseFor = createBaseFor()
|
|
836
860
|
|
|
837
861
|
/**
|
|
838
862
|
* The base implementation of `_.forOwn` without support for iteratee shorthands.
|
|
@@ -843,7 +867,7 @@ var baseFor = createBaseFor();
|
|
|
843
867
|
* @returns {Object} Returns `object`.
|
|
844
868
|
*/
|
|
845
869
|
function baseForOwn(object, iteratee) {
|
|
846
|
-
return object && baseFor(object, iteratee, keys)
|
|
870
|
+
return object && baseFor(object, iteratee, keys)
|
|
847
871
|
}
|
|
848
872
|
|
|
849
873
|
/**
|
|
@@ -855,15 +879,15 @@ function baseForOwn(object, iteratee) {
|
|
|
855
879
|
* @returns {*} Returns the resolved value.
|
|
856
880
|
*/
|
|
857
881
|
function baseGet(object, path) {
|
|
858
|
-
path = isKey(path, object) ? [path] : castPath(path)
|
|
882
|
+
path = isKey(path, object) ? [path] : castPath(path)
|
|
859
883
|
|
|
860
|
-
|
|
861
|
-
|
|
884
|
+
let index = 0
|
|
885
|
+
const length = path.length
|
|
862
886
|
|
|
863
887
|
while (object != null && index < length) {
|
|
864
|
-
object = object[toKey(path[index++])]
|
|
888
|
+
object = object[toKey(path[index++])]
|
|
865
889
|
}
|
|
866
|
-
return
|
|
890
|
+
return index && index === length ? object : undefined
|
|
867
891
|
}
|
|
868
892
|
|
|
869
893
|
/**
|
|
@@ -874,7 +898,7 @@ function baseGet(object, path) {
|
|
|
874
898
|
* @returns {string} Returns the `toStringTag`.
|
|
875
899
|
*/
|
|
876
900
|
function baseGetTag(value) {
|
|
877
|
-
return objectToString.call(value)
|
|
901
|
+
return objectToString.call(value)
|
|
878
902
|
}
|
|
879
903
|
|
|
880
904
|
/**
|
|
@@ -886,7 +910,7 @@ function baseGetTag(value) {
|
|
|
886
910
|
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
887
911
|
*/
|
|
888
912
|
function baseHasIn(object, key) {
|
|
889
|
-
return object != null && key in Object(object)
|
|
913
|
+
return object != null && key in Object(object)
|
|
890
914
|
}
|
|
891
915
|
|
|
892
916
|
/**
|
|
@@ -906,12 +930,16 @@ function baseHasIn(object, key) {
|
|
|
906
930
|
*/
|
|
907
931
|
function baseIsEqual(value, other, customizer, bitmask, stack) {
|
|
908
932
|
if (value === other) {
|
|
909
|
-
return true
|
|
933
|
+
return true
|
|
910
934
|
}
|
|
911
|
-
if (
|
|
912
|
-
|
|
935
|
+
if (
|
|
936
|
+
value == null ||
|
|
937
|
+
other == null ||
|
|
938
|
+
(!isObject(value) && !isObjectLike(other))
|
|
939
|
+
) {
|
|
940
|
+
return value !== value && other !== other
|
|
913
941
|
}
|
|
914
|
-
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack)
|
|
942
|
+
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack)
|
|
915
943
|
}
|
|
916
944
|
|
|
917
945
|
/**
|
|
@@ -930,46 +958,46 @@ function baseIsEqual(value, other, customizer, bitmask, stack) {
|
|
|
930
958
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
931
959
|
*/
|
|
932
960
|
function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
961
|
+
const objIsArr = isArray(object)
|
|
962
|
+
const othIsArr = isArray(other)
|
|
963
|
+
let objTag = arrayTag
|
|
964
|
+
let othTag = arrayTag
|
|
937
965
|
|
|
938
966
|
if (!objIsArr) {
|
|
939
|
-
objTag = getTag(object)
|
|
940
|
-
objTag = objTag
|
|
967
|
+
objTag = getTag(object)
|
|
968
|
+
objTag = objTag === argsTag ? objectTag : objTag
|
|
941
969
|
}
|
|
942
970
|
if (!othIsArr) {
|
|
943
|
-
othTag = getTag(other)
|
|
944
|
-
othTag = othTag
|
|
971
|
+
othTag = getTag(other)
|
|
972
|
+
othTag = othTag === argsTag ? objectTag : othTag
|
|
945
973
|
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
974
|
+
const objIsObj = objTag === objectTag && !isHostObject(object)
|
|
975
|
+
const othIsObj = othTag === objectTag && !isHostObject(other)
|
|
976
|
+
const isSameTag = objTag === othTag
|
|
949
977
|
|
|
950
978
|
if (isSameTag && !objIsObj) {
|
|
951
|
-
stack || (stack = new Stack)
|
|
952
|
-
return
|
|
979
|
+
stack || (stack = new Stack())
|
|
980
|
+
return objIsArr || isTypedArray(object)
|
|
953
981
|
? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
|
|
954
|
-
: equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack)
|
|
982
|
+
: equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack)
|
|
955
983
|
}
|
|
956
984
|
if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
|
|
957
|
-
|
|
958
|
-
|
|
985
|
+
const objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__')
|
|
986
|
+
const othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__')
|
|
959
987
|
|
|
960
988
|
if (objIsWrapped || othIsWrapped) {
|
|
961
|
-
|
|
962
|
-
|
|
989
|
+
const objUnwrapped = objIsWrapped ? object.value() : object
|
|
990
|
+
const othUnwrapped = othIsWrapped ? other.value() : other
|
|
963
991
|
|
|
964
|
-
stack || (stack = new Stack)
|
|
965
|
-
return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack)
|
|
992
|
+
stack || (stack = new Stack())
|
|
993
|
+
return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack)
|
|
966
994
|
}
|
|
967
995
|
}
|
|
968
996
|
if (!isSameTag) {
|
|
969
|
-
return false
|
|
997
|
+
return false
|
|
970
998
|
}
|
|
971
|
-
stack || (stack = new Stack)
|
|
972
|
-
return equalObjects(object, other, equalFunc, customizer, bitmask, stack)
|
|
999
|
+
stack || (stack = new Stack())
|
|
1000
|
+
return equalObjects(object, other, equalFunc, customizer, bitmask, stack)
|
|
973
1001
|
}
|
|
974
1002
|
|
|
975
1003
|
/**
|
|
@@ -983,47 +1011,62 @@ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
|
|
|
983
1011
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
984
1012
|
*/
|
|
985
1013
|
function baseIsMatch(object, source, matchData, customizer) {
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1014
|
+
let index = matchData.length
|
|
1015
|
+
const length = index
|
|
1016
|
+
const noCustomizer = !customizer
|
|
989
1017
|
|
|
990
1018
|
if (object == null) {
|
|
991
|
-
return !length
|
|
1019
|
+
return !length
|
|
992
1020
|
}
|
|
993
|
-
object = Object(object)
|
|
1021
|
+
object = Object(object)
|
|
994
1022
|
while (index--) {
|
|
995
|
-
|
|
996
|
-
if (
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
)
|
|
1000
|
-
|
|
1023
|
+
const data = matchData[index]
|
|
1024
|
+
if (
|
|
1025
|
+
noCustomizer && data[2]
|
|
1026
|
+
? data[1] !== object[data[0]]
|
|
1027
|
+
: !(data[0] in object)
|
|
1028
|
+
) {
|
|
1029
|
+
return false
|
|
1001
1030
|
}
|
|
1002
1031
|
}
|
|
1003
1032
|
while (++index < length) {
|
|
1004
|
-
data = matchData[index]
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1033
|
+
data = matchData[index]
|
|
1034
|
+
const key = data[0]
|
|
1035
|
+
const objValue = object[key]
|
|
1036
|
+
const srcValue = data[1]
|
|
1008
1037
|
|
|
1009
1038
|
if (noCustomizer && data[2]) {
|
|
1010
1039
|
if (objValue === undefined && !(key in object)) {
|
|
1011
|
-
return false
|
|
1040
|
+
return false
|
|
1012
1041
|
}
|
|
1013
1042
|
} else {
|
|
1014
|
-
|
|
1043
|
+
const stack = new Stack()
|
|
1015
1044
|
if (customizer) {
|
|
1016
|
-
|
|
1045
|
+
const _result = customizer(
|
|
1046
|
+
objValue,
|
|
1047
|
+
srcValue,
|
|
1048
|
+
key,
|
|
1049
|
+
object,
|
|
1050
|
+
source,
|
|
1051
|
+
stack
|
|
1052
|
+
)
|
|
1017
1053
|
}
|
|
1018
|
-
if (
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1054
|
+
if (
|
|
1055
|
+
!(result === undefined
|
|
1056
|
+
? baseIsEqual(
|
|
1057
|
+
srcValue,
|
|
1058
|
+
objValue,
|
|
1059
|
+
customizer,
|
|
1060
|
+
UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG,
|
|
1061
|
+
stack
|
|
1062
|
+
)
|
|
1063
|
+
: result)
|
|
1064
|
+
) {
|
|
1065
|
+
return false
|
|
1023
1066
|
}
|
|
1024
1067
|
}
|
|
1025
1068
|
}
|
|
1026
|
-
return true
|
|
1069
|
+
return true
|
|
1027
1070
|
}
|
|
1028
1071
|
|
|
1029
1072
|
/**
|
|
@@ -1036,10 +1079,11 @@ function baseIsMatch(object, source, matchData, customizer) {
|
|
|
1036
1079
|
*/
|
|
1037
1080
|
function baseIsNative(value) {
|
|
1038
1081
|
if (!isObject(value) || isMasked(value)) {
|
|
1039
|
-
return false
|
|
1082
|
+
return false
|
|
1040
1083
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1084
|
+
const pattern =
|
|
1085
|
+
isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor
|
|
1086
|
+
return pattern.test(toSource(value))
|
|
1043
1087
|
}
|
|
1044
1088
|
|
|
1045
1089
|
/**
|
|
@@ -1050,8 +1094,11 @@ function baseIsNative(value) {
|
|
|
1050
1094
|
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1051
1095
|
*/
|
|
1052
1096
|
function baseIsTypedArray(value) {
|
|
1053
|
-
return
|
|
1054
|
-
|
|
1097
|
+
return (
|
|
1098
|
+
isObjectLike(value) &&
|
|
1099
|
+
isLength(value.length) &&
|
|
1100
|
+
!!typedArrayTags[objectToString.call(value)]
|
|
1101
|
+
)
|
|
1055
1102
|
}
|
|
1056
1103
|
|
|
1057
1104
|
/**
|
|
@@ -1064,18 +1111,18 @@ function baseIsTypedArray(value) {
|
|
|
1064
1111
|
function baseIteratee(value) {
|
|
1065
1112
|
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
|
1066
1113
|
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
|
1067
|
-
if (typeof value
|
|
1068
|
-
return value
|
|
1114
|
+
if (typeof value === 'function') {
|
|
1115
|
+
return value
|
|
1069
1116
|
}
|
|
1070
1117
|
if (value == null) {
|
|
1071
|
-
return identity
|
|
1118
|
+
return identity
|
|
1072
1119
|
}
|
|
1073
|
-
if (typeof value
|
|
1120
|
+
if (typeof value === 'object') {
|
|
1074
1121
|
return isArray(value)
|
|
1075
1122
|
? baseMatchesProperty(value[0], value[1])
|
|
1076
|
-
: baseMatches(value)
|
|
1123
|
+
: baseMatches(value)
|
|
1077
1124
|
}
|
|
1078
|
-
return property(value)
|
|
1125
|
+
return property(value)
|
|
1079
1126
|
}
|
|
1080
1127
|
|
|
1081
1128
|
/**
|
|
@@ -1087,15 +1134,15 @@ function baseIteratee(value) {
|
|
|
1087
1134
|
*/
|
|
1088
1135
|
function baseKeys(object) {
|
|
1089
1136
|
if (!isPrototype(object)) {
|
|
1090
|
-
return nativeKeys(object)
|
|
1137
|
+
return nativeKeys(object)
|
|
1091
1138
|
}
|
|
1092
|
-
|
|
1093
|
-
for (
|
|
1094
|
-
if (hasOwnProperty.call(object, key) && key
|
|
1095
|
-
result.push(key)
|
|
1139
|
+
const result = []
|
|
1140
|
+
for (const key in Object(object)) {
|
|
1141
|
+
if (hasOwnProperty.call(object, key) && key !== 'constructor') {
|
|
1142
|
+
result.push(key)
|
|
1096
1143
|
}
|
|
1097
1144
|
}
|
|
1098
|
-
return result
|
|
1145
|
+
return result
|
|
1099
1146
|
}
|
|
1100
1147
|
|
|
1101
1148
|
/**
|
|
@@ -1106,13 +1153,11 @@ function baseKeys(object) {
|
|
|
1106
1153
|
* @returns {Function} Returns the new spec function.
|
|
1107
1154
|
*/
|
|
1108
1155
|
function baseMatches(source) {
|
|
1109
|
-
|
|
1110
|
-
if (matchData.length
|
|
1111
|
-
return matchesStrictComparable(matchData[0][0], matchData[0][1])
|
|
1156
|
+
const matchData = getMatchData(source)
|
|
1157
|
+
if (matchData.length === 1 && matchData[0][2]) {
|
|
1158
|
+
return matchesStrictComparable(matchData[0][0], matchData[0][1])
|
|
1112
1159
|
}
|
|
1113
|
-
return
|
|
1114
|
-
return object === source || baseIsMatch(object, source, matchData);
|
|
1115
|
-
};
|
|
1160
|
+
return object => object === source || baseIsMatch(object, source, matchData)
|
|
1116
1161
|
}
|
|
1117
1162
|
|
|
1118
1163
|
/**
|
|
@@ -1125,14 +1170,19 @@ function baseMatches(source) {
|
|
|
1125
1170
|
*/
|
|
1126
1171
|
function baseMatchesProperty(path, srcValue) {
|
|
1127
1172
|
if (isKey(path) && isStrictComparable(srcValue)) {
|
|
1128
|
-
return matchesStrictComparable(toKey(path), srcValue)
|
|
1173
|
+
return matchesStrictComparable(toKey(path), srcValue)
|
|
1129
1174
|
}
|
|
1130
|
-
return
|
|
1131
|
-
|
|
1132
|
-
return
|
|
1175
|
+
return object => {
|
|
1176
|
+
const objValue = get(object, path)
|
|
1177
|
+
return objValue === undefined && objValue === srcValue
|
|
1133
1178
|
? hasIn(object, path)
|
|
1134
|
-
: baseIsEqual(
|
|
1135
|
-
|
|
1179
|
+
: baseIsEqual(
|
|
1180
|
+
srcValue,
|
|
1181
|
+
objValue,
|
|
1182
|
+
undefined,
|
|
1183
|
+
UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG
|
|
1184
|
+
)
|
|
1185
|
+
}
|
|
1136
1186
|
}
|
|
1137
1187
|
|
|
1138
1188
|
/**
|
|
@@ -1143,9 +1193,7 @@ function baseMatchesProperty(path, srcValue) {
|
|
|
1143
1193
|
* @returns {Function} Returns the new accessor function.
|
|
1144
1194
|
*/
|
|
1145
1195
|
function basePropertyDeep(path) {
|
|
1146
|
-
return
|
|
1147
|
-
return baseGet(object, path);
|
|
1148
|
-
};
|
|
1196
|
+
return object => baseGet(object, path)
|
|
1149
1197
|
}
|
|
1150
1198
|
|
|
1151
1199
|
/**
|
|
@@ -1158,14 +1206,14 @@ function basePropertyDeep(path) {
|
|
|
1158
1206
|
*/
|
|
1159
1207
|
function baseToString(value) {
|
|
1160
1208
|
// Exit early for strings to avoid a performance hit in some environments.
|
|
1161
|
-
if (typeof value
|
|
1162
|
-
return value
|
|
1209
|
+
if (typeof value === 'string') {
|
|
1210
|
+
return value
|
|
1163
1211
|
}
|
|
1164
1212
|
if (isSymbol(value)) {
|
|
1165
|
-
return symbolToString ? symbolToString.call(value) : ''
|
|
1213
|
+
return symbolToString ? symbolToString.call(value) : ''
|
|
1166
1214
|
}
|
|
1167
|
-
|
|
1168
|
-
return
|
|
1215
|
+
const result = `${value}`
|
|
1216
|
+
return result === '0' && 1 / value === -INFINITY ? '-0' : result
|
|
1169
1217
|
}
|
|
1170
1218
|
|
|
1171
1219
|
/**
|
|
@@ -1176,7 +1224,7 @@ function baseToString(value) {
|
|
|
1176
1224
|
* @returns {Array} Returns the cast property path array.
|
|
1177
1225
|
*/
|
|
1178
1226
|
function castPath(value) {
|
|
1179
|
-
return isArray(value) ? value : stringToPath(value)
|
|
1227
|
+
return isArray(value) ? value : stringToPath(value)
|
|
1180
1228
|
}
|
|
1181
1229
|
|
|
1182
1230
|
/**
|
|
@@ -1187,20 +1235,20 @@ function castPath(value) {
|
|
|
1187
1235
|
* @returns {Function} Returns the new base function.
|
|
1188
1236
|
*/
|
|
1189
1237
|
function createBaseFor(fromRight) {
|
|
1190
|
-
return
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1238
|
+
return (object, iteratee, keysFunc) => {
|
|
1239
|
+
let index = -1
|
|
1240
|
+
const iterable = Object(object)
|
|
1241
|
+
const props = keysFunc(object)
|
|
1242
|
+
let length = props.length
|
|
1195
1243
|
|
|
1196
1244
|
while (length--) {
|
|
1197
|
-
|
|
1245
|
+
const key = props[fromRight ? length : ++index]
|
|
1198
1246
|
if (iteratee(iterable[key], key, iterable) === false) {
|
|
1199
|
-
break
|
|
1247
|
+
break
|
|
1200
1248
|
}
|
|
1201
1249
|
}
|
|
1202
|
-
return object
|
|
1203
|
-
}
|
|
1250
|
+
return object
|
|
1251
|
+
}
|
|
1204
1252
|
}
|
|
1205
1253
|
|
|
1206
1254
|
/**
|
|
@@ -1218,64 +1266,71 @@ function createBaseFor(fromRight) {
|
|
|
1218
1266
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
1219
1267
|
*/
|
|
1220
1268
|
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1269
|
+
const isPartial = bitmask & PARTIAL_COMPARE_FLAG
|
|
1270
|
+
const arrLength = array.length
|
|
1271
|
+
const othLength = other.length
|
|
1224
1272
|
|
|
1225
|
-
if (arrLength
|
|
1226
|
-
return false
|
|
1273
|
+
if (arrLength !== othLength && !(isPartial && othLength > arrLength)) {
|
|
1274
|
+
return false
|
|
1227
1275
|
}
|
|
1228
1276
|
// Assume cyclic values are equal.
|
|
1229
|
-
|
|
1277
|
+
const stacked = stack.get(array)
|
|
1230
1278
|
if (stacked && stack.get(other)) {
|
|
1231
|
-
return stacked
|
|
1279
|
+
return stacked === other
|
|
1232
1280
|
}
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1281
|
+
let index = -1
|
|
1282
|
+
let result = true
|
|
1283
|
+
const seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache() : undefined
|
|
1236
1284
|
|
|
1237
|
-
stack.set(array, other)
|
|
1238
|
-
stack.set(other, array)
|
|
1285
|
+
stack.set(array, other)
|
|
1286
|
+
stack.set(other, array)
|
|
1239
1287
|
|
|
1240
1288
|
// Ignore non-index properties.
|
|
1241
1289
|
while (++index < arrLength) {
|
|
1242
|
-
|
|
1243
|
-
|
|
1290
|
+
const arrValue = array[index]
|
|
1291
|
+
const othValue = other[index]
|
|
1244
1292
|
|
|
1245
1293
|
if (customizer) {
|
|
1246
|
-
|
|
1294
|
+
const _compared = isPartial
|
|
1247
1295
|
? customizer(othValue, arrValue, index, other, array, stack)
|
|
1248
|
-
: customizer(arrValue, othValue, index, array, other, stack)
|
|
1296
|
+
: customizer(arrValue, othValue, index, array, other, stack)
|
|
1249
1297
|
}
|
|
1250
1298
|
if (compared !== undefined) {
|
|
1251
1299
|
if (compared) {
|
|
1252
|
-
continue
|
|
1300
|
+
continue
|
|
1253
1301
|
}
|
|
1254
|
-
result = false
|
|
1255
|
-
break
|
|
1302
|
+
result = false
|
|
1303
|
+
break
|
|
1256
1304
|
}
|
|
1257
1305
|
// Recursively compare arrays (susceptible to call stack limits).
|
|
1258
1306
|
if (seen) {
|
|
1259
|
-
if (
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1307
|
+
if (
|
|
1308
|
+
!arraySome(other, (othValue, othIndex) => {
|
|
1309
|
+
if (
|
|
1310
|
+
!seen.has(othIndex) &&
|
|
1311
|
+
(arrValue === othValue ||
|
|
1312
|
+
equalFunc(arrValue, othValue, customizer, bitmask, stack))
|
|
1313
|
+
) {
|
|
1314
|
+
return seen.add(othIndex)
|
|
1315
|
+
}
|
|
1316
|
+
})
|
|
1317
|
+
) {
|
|
1318
|
+
result = false
|
|
1319
|
+
break
|
|
1267
1320
|
}
|
|
1268
|
-
} else if (
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
)
|
|
1272
|
-
|
|
1273
|
-
|
|
1321
|
+
} else if (
|
|
1322
|
+
!(
|
|
1323
|
+
arrValue === othValue ||
|
|
1324
|
+
equalFunc(arrValue, othValue, customizer, bitmask, stack)
|
|
1325
|
+
)
|
|
1326
|
+
) {
|
|
1327
|
+
result = false
|
|
1328
|
+
break
|
|
1274
1329
|
}
|
|
1275
1330
|
}
|
|
1276
|
-
stack
|
|
1277
|
-
stack
|
|
1278
|
-
return result
|
|
1331
|
+
stack.delete(array)
|
|
1332
|
+
stack.delete(other)
|
|
1333
|
+
return result
|
|
1279
1334
|
}
|
|
1280
1335
|
|
|
1281
1336
|
/**
|
|
@@ -1299,66 +1354,79 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
|
|
1299
1354
|
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
|
|
1300
1355
|
switch (tag) {
|
|
1301
1356
|
case dataViewTag:
|
|
1302
|
-
if (
|
|
1303
|
-
|
|
1304
|
-
|
|
1357
|
+
if (
|
|
1358
|
+
object.byteLength !== other.byteLength ||
|
|
1359
|
+
object.byteOffset !== other.byteOffset
|
|
1360
|
+
) {
|
|
1361
|
+
return false
|
|
1305
1362
|
}
|
|
1306
|
-
object = object.buffer
|
|
1307
|
-
other = other.buffer
|
|
1363
|
+
object = object.buffer
|
|
1364
|
+
other = other.buffer
|
|
1308
1365
|
|
|
1309
1366
|
case arrayBufferTag:
|
|
1310
|
-
if (
|
|
1311
|
-
|
|
1312
|
-
|
|
1367
|
+
if (
|
|
1368
|
+
object.byteLength !== other.byteLength ||
|
|
1369
|
+
!equalFunc(new Uint8Array(object), new Uint8Array(other))
|
|
1370
|
+
) {
|
|
1371
|
+
return false
|
|
1313
1372
|
}
|
|
1314
|
-
return true
|
|
1373
|
+
return true
|
|
1315
1374
|
|
|
1316
1375
|
case boolTag:
|
|
1317
1376
|
case dateTag:
|
|
1318
1377
|
case numberTag:
|
|
1319
1378
|
// Coerce booleans to `1` or `0` and dates to milliseconds.
|
|
1320
1379
|
// Invalid dates are coerced to `NaN`.
|
|
1321
|
-
return eq(+object, +other)
|
|
1380
|
+
return eq(+object, +other)
|
|
1322
1381
|
|
|
1323
1382
|
case errorTag:
|
|
1324
|
-
return object.name
|
|
1383
|
+
return object.name === other.name && object.message === other.message
|
|
1325
1384
|
|
|
1326
1385
|
case regexpTag:
|
|
1327
1386
|
case stringTag:
|
|
1328
1387
|
// Coerce regexes to strings and treat strings, primitives and objects,
|
|
1329
1388
|
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
|
1330
1389
|
// for more details.
|
|
1331
|
-
return object
|
|
1390
|
+
return object === `${other}`
|
|
1332
1391
|
|
|
1333
|
-
case mapTag:
|
|
1334
|
-
|
|
1392
|
+
case mapTag: {
|
|
1393
|
+
const _convert = mapToArray
|
|
1394
|
+
}
|
|
1335
1395
|
|
|
1336
|
-
case setTag:
|
|
1337
|
-
|
|
1338
|
-
convert || (convert = setToArray)
|
|
1396
|
+
case setTag: {
|
|
1397
|
+
const isPartial = bitmask & PARTIAL_COMPARE_FLAG
|
|
1398
|
+
convert || (convert = setToArray)
|
|
1339
1399
|
|
|
1340
|
-
if (object.size
|
|
1341
|
-
return false
|
|
1400
|
+
if (object.size !== other.size && !isPartial) {
|
|
1401
|
+
return false
|
|
1342
1402
|
}
|
|
1343
1403
|
// Assume cyclic values are equal.
|
|
1344
|
-
|
|
1404
|
+
const stacked = stack.get(object)
|
|
1345
1405
|
if (stacked) {
|
|
1346
|
-
return stacked
|
|
1406
|
+
return stacked === other
|
|
1347
1407
|
}
|
|
1348
|
-
bitmask |= UNORDERED_COMPARE_FLAG
|
|
1408
|
+
bitmask |= UNORDERED_COMPARE_FLAG
|
|
1349
1409
|
|
|
1350
1410
|
// Recursively compare objects (susceptible to call stack limits).
|
|
1351
|
-
stack.set(object, other)
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1411
|
+
stack.set(object, other)
|
|
1412
|
+
const result = equalArrays(
|
|
1413
|
+
convert(object),
|
|
1414
|
+
convert(other),
|
|
1415
|
+
equalFunc,
|
|
1416
|
+
customizer,
|
|
1417
|
+
bitmask,
|
|
1418
|
+
stack
|
|
1419
|
+
)
|
|
1420
|
+
stack.delete(object)
|
|
1421
|
+
return result
|
|
1422
|
+
}
|
|
1355
1423
|
|
|
1356
1424
|
case symbolTag:
|
|
1357
1425
|
if (symbolValueOf) {
|
|
1358
|
-
return symbolValueOf.call(object)
|
|
1426
|
+
return symbolValueOf.call(object) === symbolValueOf.call(other)
|
|
1359
1427
|
}
|
|
1360
1428
|
}
|
|
1361
|
-
return false
|
|
1429
|
+
return false
|
|
1362
1430
|
}
|
|
1363
1431
|
|
|
1364
1432
|
/**
|
|
@@ -1376,67 +1444,76 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
|
|
|
1376
1444
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
1377
1445
|
*/
|
|
1378
1446
|
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
if (objLength
|
|
1386
|
-
return false
|
|
1447
|
+
const isPartial = bitmask & PARTIAL_COMPARE_FLAG
|
|
1448
|
+
const objProps = keys(object)
|
|
1449
|
+
const objLength = objProps.length
|
|
1450
|
+
const othProps = keys(other)
|
|
1451
|
+
const othLength = othProps.length
|
|
1452
|
+
|
|
1453
|
+
if (objLength !== othLength && !isPartial) {
|
|
1454
|
+
return false
|
|
1387
1455
|
}
|
|
1388
|
-
|
|
1456
|
+
let index = objLength
|
|
1389
1457
|
while (index--) {
|
|
1390
|
-
|
|
1458
|
+
const key = objProps[index]
|
|
1391
1459
|
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
|
1392
|
-
return false
|
|
1460
|
+
return false
|
|
1393
1461
|
}
|
|
1394
1462
|
}
|
|
1395
1463
|
// Assume cyclic values are equal.
|
|
1396
|
-
|
|
1464
|
+
const stacked = stack.get(object)
|
|
1397
1465
|
if (stacked && stack.get(other)) {
|
|
1398
|
-
return stacked
|
|
1466
|
+
return stacked === other
|
|
1399
1467
|
}
|
|
1400
|
-
|
|
1401
|
-
stack.set(object, other)
|
|
1402
|
-
stack.set(other, object)
|
|
1468
|
+
let result = true
|
|
1469
|
+
stack.set(object, other)
|
|
1470
|
+
stack.set(other, object)
|
|
1403
1471
|
|
|
1404
|
-
|
|
1472
|
+
let skipCtor = isPartial
|
|
1405
1473
|
while (++index < objLength) {
|
|
1406
|
-
key = objProps[index]
|
|
1407
|
-
|
|
1408
|
-
|
|
1474
|
+
key = objProps[index]
|
|
1475
|
+
const objValue = object[key]
|
|
1476
|
+
const othValue = other[key]
|
|
1409
1477
|
|
|
1410
1478
|
if (customizer) {
|
|
1411
|
-
|
|
1479
|
+
const _compared = isPartial
|
|
1412
1480
|
? customizer(othValue, objValue, key, other, object, stack)
|
|
1413
|
-
: customizer(objValue, othValue, key, object, other, stack)
|
|
1481
|
+
: customizer(objValue, othValue, key, object, other, stack)
|
|
1414
1482
|
}
|
|
1415
1483
|
// Recursively compare objects (susceptible to call stack limits).
|
|
1416
|
-
if (
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1484
|
+
if (
|
|
1485
|
+
!(compared === undefined
|
|
1486
|
+
? objValue === othValue ||
|
|
1487
|
+
equalFunc(objValue, othValue, customizer, bitmask, stack)
|
|
1488
|
+
: compared)
|
|
1489
|
+
) {
|
|
1490
|
+
result = false
|
|
1491
|
+
break
|
|
1422
1492
|
}
|
|
1423
|
-
skipCtor || (skipCtor = key
|
|
1493
|
+
skipCtor || (skipCtor = key === 'constructor')
|
|
1424
1494
|
}
|
|
1425
1495
|
if (result && !skipCtor) {
|
|
1426
|
-
|
|
1427
|
-
|
|
1496
|
+
const objCtor = object.constructor
|
|
1497
|
+
const othCtor = other.constructor
|
|
1428
1498
|
|
|
1429
1499
|
// Non `Object` object instances with different constructors are not equal.
|
|
1430
|
-
if (
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1500
|
+
if (
|
|
1501
|
+
objCtor !== othCtor &&
|
|
1502
|
+
'constructor' in object &&
|
|
1503
|
+
'constructor' in other &&
|
|
1504
|
+
!(
|
|
1505
|
+
typeof objCtor === 'function' &&
|
|
1506
|
+
objCtor instanceof objCtor &&
|
|
1507
|
+
typeof othCtor === 'function' &&
|
|
1508
|
+
othCtor instanceof othCtor
|
|
1509
|
+
)
|
|
1510
|
+
) {
|
|
1511
|
+
result = false
|
|
1435
1512
|
}
|
|
1436
1513
|
}
|
|
1437
|
-
stack
|
|
1438
|
-
stack
|
|
1439
|
-
return result
|
|
1514
|
+
stack.delete(object)
|
|
1515
|
+
stack.delete(other)
|
|
1516
|
+
return result
|
|
1440
1517
|
}
|
|
1441
1518
|
|
|
1442
1519
|
/**
|
|
@@ -1448,10 +1525,10 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
|
|
|
1448
1525
|
* @returns {*} Returns the map data.
|
|
1449
1526
|
*/
|
|
1450
1527
|
function getMapData(map, key) {
|
|
1451
|
-
|
|
1528
|
+
const data = map.__data__
|
|
1452
1529
|
return isKeyable(key)
|
|
1453
|
-
? data[typeof key
|
|
1454
|
-
: data.map
|
|
1530
|
+
? data[typeof key === 'string' ? 'string' : 'hash']
|
|
1531
|
+
: data.map
|
|
1455
1532
|
}
|
|
1456
1533
|
|
|
1457
1534
|
/**
|
|
@@ -1462,16 +1539,16 @@ function getMapData(map, key) {
|
|
|
1462
1539
|
* @returns {Array} Returns the match data of `object`.
|
|
1463
1540
|
*/
|
|
1464
1541
|
function getMatchData(object) {
|
|
1465
|
-
|
|
1466
|
-
|
|
1542
|
+
const result = keys(object)
|
|
1543
|
+
let length = result.length
|
|
1467
1544
|
|
|
1468
1545
|
while (length--) {
|
|
1469
|
-
|
|
1470
|
-
|
|
1546
|
+
const key = result[length]
|
|
1547
|
+
const value = object[key]
|
|
1471
1548
|
|
|
1472
|
-
result[length] = [key, value, isStrictComparable(value)]
|
|
1549
|
+
result[length] = [key, value, isStrictComparable(value)]
|
|
1473
1550
|
}
|
|
1474
|
-
return result
|
|
1551
|
+
return result
|
|
1475
1552
|
}
|
|
1476
1553
|
|
|
1477
1554
|
/**
|
|
@@ -1483,8 +1560,8 @@ function getMatchData(object) {
|
|
|
1483
1560
|
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
1484
1561
|
*/
|
|
1485
1562
|
function getNative(object, key) {
|
|
1486
|
-
|
|
1487
|
-
return baseIsNative(value) ? value : undefined
|
|
1563
|
+
const value = getValue(object, key)
|
|
1564
|
+
return baseIsNative(value) ? value : undefined
|
|
1488
1565
|
}
|
|
1489
1566
|
|
|
1490
1567
|
/**
|
|
@@ -1494,31 +1571,38 @@ function getNative(object, key) {
|
|
|
1494
1571
|
* @param {*} value The value to query.
|
|
1495
1572
|
* @returns {string} Returns the `toStringTag`.
|
|
1496
1573
|
*/
|
|
1497
|
-
|
|
1574
|
+
let getTag = baseGetTag
|
|
1498
1575
|
|
|
1499
1576
|
// Fallback for data views, maps, sets, and weak maps in IE 11,
|
|
1500
1577
|
// for data views in Edge < 14, and promises in Node.js.
|
|
1501
|
-
if (
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1578
|
+
if (
|
|
1579
|
+
(DataView && getTag(new DataView(new ArrayBuffer(1))) !== dataViewTag) ||
|
|
1580
|
+
(Map && getTag(new Map()) !== mapTag) ||
|
|
1581
|
+
(Promise && getTag(Promise.resolve()) !== promiseTag) ||
|
|
1582
|
+
(Set && getTag(new Set()) !== setTag) ||
|
|
1583
|
+
(WeakMap && getTag(new WeakMap()) !== weakMapTag)
|
|
1584
|
+
) {
|
|
1585
|
+
getTag = value => {
|
|
1586
|
+
const result = objectToString.call(value)
|
|
1587
|
+
const Ctor = result === objectTag ? value.constructor : undefined
|
|
1588
|
+
const ctorString = Ctor ? toSource(Ctor) : undefined
|
|
1510
1589
|
|
|
1511
1590
|
if (ctorString) {
|
|
1512
1591
|
switch (ctorString) {
|
|
1513
|
-
case dataViewCtorString:
|
|
1514
|
-
|
|
1515
|
-
case
|
|
1516
|
-
|
|
1517
|
-
case
|
|
1592
|
+
case dataViewCtorString:
|
|
1593
|
+
return dataViewTag
|
|
1594
|
+
case mapCtorString:
|
|
1595
|
+
return mapTag
|
|
1596
|
+
case promiseCtorString:
|
|
1597
|
+
return promiseTag
|
|
1598
|
+
case setCtorString:
|
|
1599
|
+
return setTag
|
|
1600
|
+
case weakMapCtorString:
|
|
1601
|
+
return weakMapTag
|
|
1518
1602
|
}
|
|
1519
1603
|
}
|
|
1520
|
-
return result
|
|
1521
|
-
}
|
|
1604
|
+
return result
|
|
1605
|
+
}
|
|
1522
1606
|
}
|
|
1523
1607
|
|
|
1524
1608
|
/**
|
|
@@ -1531,25 +1615,29 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
|
1531
1615
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
1532
1616
|
*/
|
|
1533
1617
|
function hasPath(object, path, hasFunc) {
|
|
1534
|
-
path = isKey(path, object) ? [path] : castPath(path)
|
|
1618
|
+
path = isKey(path, object) ? [path] : castPath(path)
|
|
1535
1619
|
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1620
|
+
let result
|
|
1621
|
+
let index = -1
|
|
1622
|
+
const _length = path.length
|
|
1539
1623
|
|
|
1540
1624
|
while (++index < length) {
|
|
1541
|
-
|
|
1625
|
+
const key = toKey(path[index])
|
|
1542
1626
|
if (!(result = object != null && hasFunc(object, key))) {
|
|
1543
|
-
break
|
|
1627
|
+
break
|
|
1544
1628
|
}
|
|
1545
|
-
object = object[key]
|
|
1629
|
+
object = object[key]
|
|
1546
1630
|
}
|
|
1547
1631
|
if (result) {
|
|
1548
|
-
return result
|
|
1632
|
+
return result
|
|
1549
1633
|
}
|
|
1550
|
-
|
|
1551
|
-
return
|
|
1552
|
-
|
|
1634
|
+
const length = object ? object.length : 0
|
|
1635
|
+
return (
|
|
1636
|
+
!!length &&
|
|
1637
|
+
isLength(length) &&
|
|
1638
|
+
isIndex(key, length) &&
|
|
1639
|
+
(isArray(object) || isArguments(object))
|
|
1640
|
+
)
|
|
1553
1641
|
}
|
|
1554
1642
|
|
|
1555
1643
|
/**
|
|
@@ -1561,10 +1649,14 @@ function hasPath(object, path, hasFunc) {
|
|
|
1561
1649
|
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
1562
1650
|
*/
|
|
1563
1651
|
function isIndex(value, length) {
|
|
1564
|
-
length = length == null ? MAX_SAFE_INTEGER : length
|
|
1565
|
-
return
|
|
1566
|
-
|
|
1567
|
-
(value
|
|
1652
|
+
length = length == null ? MAX_SAFE_INTEGER : length
|
|
1653
|
+
return (
|
|
1654
|
+
!!length &&
|
|
1655
|
+
(typeof value === 'number' || reIsUint.test(value)) &&
|
|
1656
|
+
value > -1 &&
|
|
1657
|
+
value % 1 === 0 &&
|
|
1658
|
+
value < length
|
|
1659
|
+
)
|
|
1568
1660
|
}
|
|
1569
1661
|
|
|
1570
1662
|
/**
|
|
@@ -1577,15 +1669,23 @@ function isIndex(value, length) {
|
|
|
1577
1669
|
*/
|
|
1578
1670
|
function isKey(value, object) {
|
|
1579
1671
|
if (isArray(value)) {
|
|
1580
|
-
return false
|
|
1672
|
+
return false
|
|
1581
1673
|
}
|
|
1582
|
-
|
|
1583
|
-
if (
|
|
1584
|
-
|
|
1585
|
-
|
|
1674
|
+
const type = typeof value
|
|
1675
|
+
if (
|
|
1676
|
+
type === 'number' ||
|
|
1677
|
+
type === 'symbol' ||
|
|
1678
|
+
type === 'boolean' ||
|
|
1679
|
+
value == null ||
|
|
1680
|
+
isSymbol(value)
|
|
1681
|
+
) {
|
|
1682
|
+
return true
|
|
1586
1683
|
}
|
|
1587
|
-
return
|
|
1588
|
-
(
|
|
1684
|
+
return (
|
|
1685
|
+
reIsPlainProp.test(value) ||
|
|
1686
|
+
!reIsDeepProp.test(value) ||
|
|
1687
|
+
(object != null && value in Object(object))
|
|
1688
|
+
)
|
|
1589
1689
|
}
|
|
1590
1690
|
|
|
1591
1691
|
/**
|
|
@@ -1596,10 +1696,13 @@ function isKey(value, object) {
|
|
|
1596
1696
|
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1597
1697
|
*/
|
|
1598
1698
|
function isKeyable(value) {
|
|
1599
|
-
|
|
1600
|
-
return
|
|
1601
|
-
|
|
1602
|
-
|
|
1699
|
+
const type = typeof value
|
|
1700
|
+
return type === 'string' ||
|
|
1701
|
+
type === 'number' ||
|
|
1702
|
+
type === 'symbol' ||
|
|
1703
|
+
type === 'boolean'
|
|
1704
|
+
? value !== '__proto__'
|
|
1705
|
+
: value === null
|
|
1603
1706
|
}
|
|
1604
1707
|
|
|
1605
1708
|
/**
|
|
@@ -1610,7 +1713,7 @@ function isKeyable(value) {
|
|
|
1610
1713
|
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
1611
1714
|
*/
|
|
1612
1715
|
function isMasked(func) {
|
|
1613
|
-
return !!maskSrcKey &&
|
|
1716
|
+
return !!maskSrcKey && maskSrcKey in func
|
|
1614
1717
|
}
|
|
1615
1718
|
|
|
1616
1719
|
/**
|
|
@@ -1621,10 +1724,10 @@ function isMasked(func) {
|
|
|
1621
1724
|
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
1622
1725
|
*/
|
|
1623
1726
|
function isPrototype(value) {
|
|
1624
|
-
|
|
1625
|
-
|
|
1727
|
+
const Ctor = value?.constructor
|
|
1728
|
+
const proto = (typeof Ctor === 'function' && Ctor.prototype) || objectProto
|
|
1626
1729
|
|
|
1627
|
-
return value === proto
|
|
1730
|
+
return value === proto
|
|
1628
1731
|
}
|
|
1629
1732
|
|
|
1630
1733
|
/**
|
|
@@ -1636,7 +1739,7 @@ function isPrototype(value) {
|
|
|
1636
1739
|
* equality comparisons, else `false`.
|
|
1637
1740
|
*/
|
|
1638
1741
|
function isStrictComparable(value) {
|
|
1639
|
-
return value === value && !isObject(value)
|
|
1742
|
+
return value === value && !isObject(value)
|
|
1640
1743
|
}
|
|
1641
1744
|
|
|
1642
1745
|
/**
|
|
@@ -1649,13 +1752,15 @@ function isStrictComparable(value) {
|
|
|
1649
1752
|
* @returns {Function} Returns the new spec function.
|
|
1650
1753
|
*/
|
|
1651
1754
|
function matchesStrictComparable(key, srcValue) {
|
|
1652
|
-
return
|
|
1755
|
+
return object => {
|
|
1653
1756
|
if (object == null) {
|
|
1654
|
-
return false
|
|
1757
|
+
return false
|
|
1655
1758
|
}
|
|
1656
|
-
return
|
|
1657
|
-
|
|
1658
|
-
|
|
1759
|
+
return (
|
|
1760
|
+
object[key] === srcValue &&
|
|
1761
|
+
(srcValue !== undefined || key in Object(object))
|
|
1762
|
+
)
|
|
1763
|
+
}
|
|
1659
1764
|
}
|
|
1660
1765
|
|
|
1661
1766
|
/**
|
|
@@ -1665,18 +1770,18 @@ function matchesStrictComparable(key, srcValue) {
|
|
|
1665
1770
|
* @param {string} string The string to convert.
|
|
1666
1771
|
* @returns {Array} Returns the property path array.
|
|
1667
1772
|
*/
|
|
1668
|
-
|
|
1669
|
-
string = toString(string)
|
|
1773
|
+
const stringToPath = memoize(string => {
|
|
1774
|
+
string = toString(string)
|
|
1670
1775
|
|
|
1671
|
-
|
|
1776
|
+
const result = []
|
|
1672
1777
|
if (reLeadingDot.test(string)) {
|
|
1673
|
-
result.push('')
|
|
1778
|
+
result.push('')
|
|
1674
1779
|
}
|
|
1675
|
-
string.replace(rePropName,
|
|
1676
|
-
result.push(quote ? string.replace(reEscapeChar, '$1') :
|
|
1677
|
-
})
|
|
1678
|
-
return result
|
|
1679
|
-
})
|
|
1780
|
+
string.replace(rePropName, (match, number, quote, string) => {
|
|
1781
|
+
result.push(quote ? string.replace(reEscapeChar, '$1') : number || match)
|
|
1782
|
+
})
|
|
1783
|
+
return result
|
|
1784
|
+
})
|
|
1680
1785
|
|
|
1681
1786
|
/**
|
|
1682
1787
|
* Converts `value` to a string key if it's not a string or symbol.
|
|
@@ -1686,11 +1791,11 @@ var stringToPath = memoize(function(string) {
|
|
|
1686
1791
|
* @returns {string|symbol} Returns the key.
|
|
1687
1792
|
*/
|
|
1688
1793
|
function toKey(value) {
|
|
1689
|
-
if (typeof value
|
|
1690
|
-
return value
|
|
1794
|
+
if (typeof value === 'string' || isSymbol(value)) {
|
|
1795
|
+
return value
|
|
1691
1796
|
}
|
|
1692
|
-
|
|
1693
|
-
return
|
|
1797
|
+
const result = `${value}`
|
|
1798
|
+
return result === '0' && 1 / value === -INFINITY ? '-0' : result
|
|
1694
1799
|
}
|
|
1695
1800
|
|
|
1696
1801
|
/**
|
|
@@ -1703,13 +1808,13 @@ function toKey(value) {
|
|
|
1703
1808
|
function toSource(func) {
|
|
1704
1809
|
if (func != null) {
|
|
1705
1810
|
try {
|
|
1706
|
-
return funcToString.call(func)
|
|
1707
|
-
} catch (
|
|
1811
|
+
return funcToString.call(func)
|
|
1812
|
+
} catch (_e) {}
|
|
1708
1813
|
try {
|
|
1709
|
-
return
|
|
1710
|
-
} catch (
|
|
1814
|
+
return `${func}`
|
|
1815
|
+
} catch (_e) {}
|
|
1711
1816
|
}
|
|
1712
|
-
return ''
|
|
1817
|
+
return ''
|
|
1713
1818
|
}
|
|
1714
1819
|
|
|
1715
1820
|
/**
|
|
@@ -1757,27 +1862,30 @@ function toSource(func) {
|
|
|
1757
1862
|
* _.memoize.Cache = WeakMap;
|
|
1758
1863
|
*/
|
|
1759
1864
|
function memoize(func, resolver) {
|
|
1760
|
-
if (
|
|
1761
|
-
|
|
1865
|
+
if (
|
|
1866
|
+
typeof func !== 'function' ||
|
|
1867
|
+
(resolver && typeof resolver !== 'function')
|
|
1868
|
+
) {
|
|
1869
|
+
throw new TypeError(FUNC_ERROR_TEXT)
|
|
1762
1870
|
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1871
|
+
const memoized = function () {
|
|
1872
|
+
const args = arguments
|
|
1873
|
+
const key = resolver ? resolver.apply(this, args) : args[0]
|
|
1874
|
+
const cache = memoized.cache
|
|
1767
1875
|
|
|
1768
1876
|
if (cache.has(key)) {
|
|
1769
|
-
return cache.get(key)
|
|
1877
|
+
return cache.get(key)
|
|
1770
1878
|
}
|
|
1771
|
-
|
|
1772
|
-
memoized.cache = cache.set(key, result)
|
|
1773
|
-
return result
|
|
1774
|
-
}
|
|
1775
|
-
memoized.cache = new (memoize.Cache || MapCache)
|
|
1776
|
-
return memoized
|
|
1879
|
+
const result = func.apply(this, args)
|
|
1880
|
+
memoized.cache = cache.set(key, result)
|
|
1881
|
+
return result
|
|
1882
|
+
}
|
|
1883
|
+
memoized.cache = new (memoize.Cache || MapCache)()
|
|
1884
|
+
return memoized
|
|
1777
1885
|
}
|
|
1778
1886
|
|
|
1779
1887
|
// Assign cache to `_.memoize`.
|
|
1780
|
-
memoize.Cache = MapCache
|
|
1888
|
+
memoize.Cache = MapCache
|
|
1781
1889
|
|
|
1782
1890
|
/**
|
|
1783
1891
|
* Performs a
|
|
@@ -1812,7 +1920,7 @@ memoize.Cache = MapCache;
|
|
|
1812
1920
|
* // => true
|
|
1813
1921
|
*/
|
|
1814
1922
|
function eq(value, other) {
|
|
1815
|
-
return value === other || (value !== value && other !== other)
|
|
1923
|
+
return value === other || (value !== value && other !== other)
|
|
1816
1924
|
}
|
|
1817
1925
|
|
|
1818
1926
|
/**
|
|
@@ -1835,8 +1943,12 @@ function eq(value, other) {
|
|
|
1835
1943
|
*/
|
|
1836
1944
|
function isArguments(value) {
|
|
1837
1945
|
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
|
1838
|
-
return
|
|
1839
|
-
(
|
|
1946
|
+
return (
|
|
1947
|
+
isArrayLikeObject(value) &&
|
|
1948
|
+
hasOwnProperty.call(value, 'callee') &&
|
|
1949
|
+
(!propertyIsEnumerable.call(value, 'callee') ||
|
|
1950
|
+
objectToString.call(value) === argsTag)
|
|
1951
|
+
)
|
|
1840
1952
|
}
|
|
1841
1953
|
|
|
1842
1954
|
/**
|
|
@@ -1862,7 +1974,7 @@ function isArguments(value) {
|
|
|
1862
1974
|
* _.isArray(_.noop);
|
|
1863
1975
|
* // => false
|
|
1864
1976
|
*/
|
|
1865
|
-
|
|
1977
|
+
const isArray = Array.isArray
|
|
1866
1978
|
|
|
1867
1979
|
/**
|
|
1868
1980
|
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
@@ -1890,7 +2002,7 @@ var isArray = Array.isArray;
|
|
|
1890
2002
|
* // => false
|
|
1891
2003
|
*/
|
|
1892
2004
|
function isArrayLike(value) {
|
|
1893
|
-
return value != null && isLength(value.length) && !isFunction(value)
|
|
2005
|
+
return value != null && isLength(value.length) && !isFunction(value)
|
|
1894
2006
|
}
|
|
1895
2007
|
|
|
1896
2008
|
/**
|
|
@@ -1919,7 +2031,7 @@ function isArrayLike(value) {
|
|
|
1919
2031
|
* // => false
|
|
1920
2032
|
*/
|
|
1921
2033
|
function isArrayLikeObject(value) {
|
|
1922
|
-
return isObjectLike(value) && isArrayLike(value)
|
|
2034
|
+
return isObjectLike(value) && isArrayLike(value)
|
|
1923
2035
|
}
|
|
1924
2036
|
|
|
1925
2037
|
/**
|
|
@@ -1942,8 +2054,8 @@ function isArrayLikeObject(value) {
|
|
|
1942
2054
|
function isFunction(value) {
|
|
1943
2055
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
1944
2056
|
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
|
1945
|
-
|
|
1946
|
-
return tag
|
|
2057
|
+
const tag = isObject(value) ? objectToString.call(value) : ''
|
|
2058
|
+
return tag === funcTag || tag === genTag
|
|
1947
2059
|
}
|
|
1948
2060
|
|
|
1949
2061
|
/**
|
|
@@ -1973,8 +2085,12 @@ function isFunction(value) {
|
|
|
1973
2085
|
* // => false
|
|
1974
2086
|
*/
|
|
1975
2087
|
function isLength(value) {
|
|
1976
|
-
return
|
|
1977
|
-
|
|
2088
|
+
return (
|
|
2089
|
+
typeof value === 'number' &&
|
|
2090
|
+
value > -1 &&
|
|
2091
|
+
value % 1 === 0 &&
|
|
2092
|
+
value <= MAX_SAFE_INTEGER
|
|
2093
|
+
)
|
|
1978
2094
|
}
|
|
1979
2095
|
|
|
1980
2096
|
/**
|
|
@@ -2003,8 +2119,8 @@ function isLength(value) {
|
|
|
2003
2119
|
* // => false
|
|
2004
2120
|
*/
|
|
2005
2121
|
function isObject(value) {
|
|
2006
|
-
|
|
2007
|
-
return !!value && (type
|
|
2122
|
+
const type = typeof value
|
|
2123
|
+
return !!value && (type === 'object' || type === 'function')
|
|
2008
2124
|
}
|
|
2009
2125
|
|
|
2010
2126
|
/**
|
|
@@ -2032,7 +2148,7 @@ function isObject(value) {
|
|
|
2032
2148
|
* // => false
|
|
2033
2149
|
*/
|
|
2034
2150
|
function isObjectLike(value) {
|
|
2035
|
-
return !!value && typeof value
|
|
2151
|
+
return !!value && typeof value === 'object'
|
|
2036
2152
|
}
|
|
2037
2153
|
|
|
2038
2154
|
/**
|
|
@@ -2053,8 +2169,10 @@ function isObjectLike(value) {
|
|
|
2053
2169
|
* // => false
|
|
2054
2170
|
*/
|
|
2055
2171
|
function isSymbol(value) {
|
|
2056
|
-
return
|
|
2057
|
-
|
|
2172
|
+
return (
|
|
2173
|
+
typeof value === 'symbol' ||
|
|
2174
|
+
(isObjectLike(value) && objectToString.call(value) === symbolTag)
|
|
2175
|
+
)
|
|
2058
2176
|
}
|
|
2059
2177
|
|
|
2060
2178
|
/**
|
|
@@ -2074,7 +2192,9 @@ function isSymbol(value) {
|
|
|
2074
2192
|
* _.isTypedArray([]);
|
|
2075
2193
|
* // => false
|
|
2076
2194
|
*/
|
|
2077
|
-
|
|
2195
|
+
const isTypedArray = nodeIsTypedArray
|
|
2196
|
+
? baseUnary(nodeIsTypedArray)
|
|
2197
|
+
: baseIsTypedArray
|
|
2078
2198
|
|
|
2079
2199
|
/**
|
|
2080
2200
|
* Converts `value` to a string. An empty string is returned for `null`
|
|
@@ -2098,7 +2218,7 @@ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedA
|
|
|
2098
2218
|
* // => '1,2,3'
|
|
2099
2219
|
*/
|
|
2100
2220
|
function toString(value) {
|
|
2101
|
-
return value == null ? '' : baseToString(value)
|
|
2221
|
+
return value == null ? '' : baseToString(value)
|
|
2102
2222
|
}
|
|
2103
2223
|
|
|
2104
2224
|
/**
|
|
@@ -2127,8 +2247,8 @@ function toString(value) {
|
|
|
2127
2247
|
* // => 'default'
|
|
2128
2248
|
*/
|
|
2129
2249
|
function get(object, path, defaultValue) {
|
|
2130
|
-
|
|
2131
|
-
return result === undefined ? defaultValue : result
|
|
2250
|
+
const result = object == null ? undefined : baseGet(object, path)
|
|
2251
|
+
return result === undefined ? defaultValue : result
|
|
2132
2252
|
}
|
|
2133
2253
|
|
|
2134
2254
|
/**
|
|
@@ -2158,7 +2278,7 @@ function get(object, path, defaultValue) {
|
|
|
2158
2278
|
* // => false
|
|
2159
2279
|
*/
|
|
2160
2280
|
function hasIn(object, path) {
|
|
2161
|
-
return object != null && hasPath(object, path, baseHasIn)
|
|
2281
|
+
return object != null && hasPath(object, path, baseHasIn)
|
|
2162
2282
|
}
|
|
2163
2283
|
|
|
2164
2284
|
/**
|
|
@@ -2190,7 +2310,7 @@ function hasIn(object, path) {
|
|
|
2190
2310
|
* // => ['0', '1']
|
|
2191
2311
|
*/
|
|
2192
2312
|
function keys(object) {
|
|
2193
|
-
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object)
|
|
2313
|
+
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object)
|
|
2194
2314
|
}
|
|
2195
2315
|
|
|
2196
2316
|
/**
|
|
@@ -2222,13 +2342,13 @@ function keys(object) {
|
|
|
2222
2342
|
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
|
2223
2343
|
*/
|
|
2224
2344
|
function mapValues(object, iteratee) {
|
|
2225
|
-
|
|
2226
|
-
iteratee = baseIteratee(iteratee, 3)
|
|
2345
|
+
const result = {}
|
|
2346
|
+
iteratee = baseIteratee(iteratee, 3)
|
|
2227
2347
|
|
|
2228
|
-
baseForOwn(object,
|
|
2229
|
-
result[key] = iteratee(value, key, object)
|
|
2230
|
-
})
|
|
2231
|
-
return result
|
|
2348
|
+
baseForOwn(object, (value, key, object) => {
|
|
2349
|
+
result[key] = iteratee(value, key, object)
|
|
2350
|
+
})
|
|
2351
|
+
return result
|
|
2232
2352
|
}
|
|
2233
2353
|
|
|
2234
2354
|
/**
|
|
@@ -2248,7 +2368,7 @@ function mapValues(object, iteratee) {
|
|
|
2248
2368
|
* // => true
|
|
2249
2369
|
*/
|
|
2250
2370
|
function identity(value) {
|
|
2251
|
-
return value
|
|
2371
|
+
return value
|
|
2252
2372
|
}
|
|
2253
2373
|
|
|
2254
2374
|
/**
|
|
@@ -2274,7 +2394,7 @@ function identity(value) {
|
|
|
2274
2394
|
* // => [1, 2]
|
|
2275
2395
|
*/
|
|
2276
2396
|
function property(path) {
|
|
2277
|
-
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path)
|
|
2397
|
+
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path)
|
|
2278
2398
|
}
|
|
2279
2399
|
|
|
2280
|
-
module.exports = mapValues
|
|
2400
|
+
module.exports = mapValues
|