@ventlio/tanstack-query 0.2.63-beta.6 → 0.2.63-beta.7
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/{src/index.js → index.js} +1 -0
- package/dist/{src/index.js.map → index.js.map} +1 -1
- package/dist/index.mjs +102 -1949
- package/dist/index.mjs.map +1 -1
- package/dist/model/Model.d.ts +1 -1
- package/dist/{src/model → model}/Model.js +6 -6
- package/dist/model/index.d.ts +1 -0
- package/dist/model/model.interface.d.ts +1 -1
- package/dist/model/useQueryModel.d.ts +2 -2
- package/dist/model/useQueryModel.js +91 -0
- package/dist/model/useQueryModel.js.map +1 -0
- package/package.json +1 -1
- package/src/model/Model.ts +1 -1
- package/src/model/index.ts +1 -0
- package/src/model/model.interface.ts +1 -1
- package/src/model/useQueryModel.ts +101 -3
- package/dist/_virtual/_commonjsHelpers.js +0 -4
- package/dist/_virtual/_commonjsHelpers.js.map +0 -1
- package/dist/node_modules/lodash.result/index.js +0 -937
- package/dist/node_modules/lodash.result/index.js.map +0 -1
- package/dist/node_modules/lodash.set/index.js +0 -995
- package/dist/node_modules/lodash.set/index.js.map +0 -1
- package/dist/src/model/useQueryModel.js +0 -13
- package/dist/src/model/useQueryModel.js.map +0 -1
- /package/dist/{src/config → config}/bootstrapQueryRequest.js +0 -0
- /package/dist/{src/config → config}/bootstrapQueryRequest.js.map +0 -0
- /package/dist/{src/config → config}/useEnvironmentVariables.js +0 -0
- /package/dist/{src/config → config}/useEnvironmentVariables.js.map +0 -0
- /package/dist/{src/config → config}/useQueryConfig.js +0 -0
- /package/dist/{src/config → config}/useQueryConfig.js.map +0 -0
- /package/dist/{src/config → config}/useQueryHeaders.js +0 -0
- /package/dist/{src/config → config}/useQueryHeaders.js.map +0 -0
- /package/dist/{src/config → config}/useReactNativeEnv.js +0 -0
- /package/dist/{src/config → config}/useReactNativeEnv.js.map +0 -0
- /package/dist/{src/helpers → helpers}/scrollToTop.js +0 -0
- /package/dist/{src/helpers → helpers}/scrollToTop.js.map +0 -0
- /package/dist/{src/helpers → helpers}/timeFuncs.js +0 -0
- /package/dist/{src/helpers → helpers}/timeFuncs.js.map +0 -0
- /package/dist/{src/model → model}/Model.js.map +0 -0
- /package/dist/{src/model → model}/useKeyTrackerModel.js +0 -0
- /package/dist/{src/model → model}/useKeyTrackerModel.js.map +0 -0
- /package/dist/{src/model → model}/useRefetchQuery.js +0 -0
- /package/dist/{src/model → model}/useRefetchQuery.js.map +0 -0
- /package/dist/{src/queries → queries}/useDeleteRequest.js +0 -0
- /package/dist/{src/queries → queries}/useDeleteRequest.js.map +0 -0
- /package/dist/{src/queries → queries}/useGetRequest.js +0 -0
- /package/dist/{src/queries → queries}/useGetRequest.js.map +0 -0
- /package/dist/{src/queries → queries}/usePatchRequest.js +0 -0
- /package/dist/{src/queries → queries}/usePatchRequest.js.map +0 -0
- /package/dist/{src/queries → queries}/usePostRequest.js +0 -0
- /package/dist/{src/queries → queries}/usePostRequest.js.map +0 -0
- /package/dist/{src/request → request}/axios-instance.js +0 -0
- /package/dist/{src/request → request}/axios-instance.js.map +0 -0
- /package/dist/{src/request → request}/buildFormData.js +0 -0
- /package/dist/{src/request → request}/buildFormData.js.map +0 -0
- /package/dist/{src/request → request}/make-request.js +0 -0
- /package/dist/{src/request → request}/make-request.js.map +0 -0
- /package/dist/{src/request → request}/request.enum.js +0 -0
- /package/dist/{src/request → request}/request.enum.js.map +0 -0
- /package/dist/{src/request → request}/transformer.js +0 -0
- /package/dist/{src/request → request}/transformer.js.map +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { useQueryClient, useQuery, useMutation } from '@tanstack/react-query';
|
|
2
|
+
import result from 'lodash.result';
|
|
3
|
+
import set from 'lodash.set';
|
|
2
4
|
import { useState, useMemo, useEffect, startTransition } from 'react';
|
|
3
5
|
import axios from 'axios';
|
|
4
6
|
|
|
@@ -81,1948 +83,6 @@ const useQueryHeaders = () => {
|
|
|
81
83
|
return { setQueryHeaders, getHeaders };
|
|
82
84
|
};
|
|
83
85
|
|
|
84
|
-
const useKeyTrackerModel = (keyTracker) => {
|
|
85
|
-
const queryClient = useQueryClient();
|
|
86
|
-
const getQueryKey = (innerKeyTracker) => {
|
|
87
|
-
const queryKey = queryClient.getQueryData([innerKeyTracker ?? keyTracker]);
|
|
88
|
-
return queryKey;
|
|
89
|
-
};
|
|
90
|
-
const refetchQuery = async (innerKeyTracker) => {
|
|
91
|
-
const queryKey = getQueryKey(innerKeyTracker ?? keyTracker);
|
|
92
|
-
await queryClient.refetchQueries({
|
|
93
|
-
queryKey,
|
|
94
|
-
exact: true,
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
return { refetchQuery, getQueryKey };
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* lodash (Custom Build) <https://lodash.com/>
|
|
104
|
-
* Build: `lodash modularize exports="npm" -o ./`
|
|
105
|
-
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
106
|
-
* Released under MIT license <https://lodash.com/license>
|
|
107
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
108
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
109
|
-
*/
|
|
110
|
-
|
|
111
|
-
/** Used as the `TypeError` message for "Functions" methods. */
|
|
112
|
-
var FUNC_ERROR_TEXT$1 = 'Expected a function';
|
|
113
|
-
|
|
114
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
115
|
-
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
116
|
-
|
|
117
|
-
/** Used as references for various `Number` constants. */
|
|
118
|
-
var INFINITY$1 = 1 / 0;
|
|
119
|
-
|
|
120
|
-
/** `Object#toString` result references. */
|
|
121
|
-
var funcTag$1 = '[object Function]',
|
|
122
|
-
genTag$1 = '[object GeneratorFunction]',
|
|
123
|
-
symbolTag$1 = '[object Symbol]';
|
|
124
|
-
|
|
125
|
-
/** Used to match property names within property paths. */
|
|
126
|
-
var reIsDeepProp$1 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
127
|
-
reIsPlainProp$1 = /^\w*$/,
|
|
128
|
-
reLeadingDot$1 = /^\./,
|
|
129
|
-
rePropName$1 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Used to match `RegExp`
|
|
133
|
-
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
134
|
-
*/
|
|
135
|
-
var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
|
|
136
|
-
|
|
137
|
-
/** Used to match backslashes in property paths. */
|
|
138
|
-
var reEscapeChar$1 = /\\(\\)?/g;
|
|
139
|
-
|
|
140
|
-
/** Used to detect host constructors (Safari). */
|
|
141
|
-
var reIsHostCtor$1 = /^\[object .+?Constructor\]$/;
|
|
142
|
-
|
|
143
|
-
/** Detect free variable `global` from Node.js. */
|
|
144
|
-
var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
145
|
-
|
|
146
|
-
/** Detect free variable `self`. */
|
|
147
|
-
var freeSelf$1 = typeof self == 'object' && self && self.Object === Object && self;
|
|
148
|
-
|
|
149
|
-
/** Used as a reference to the global object. */
|
|
150
|
-
var root$1 = freeGlobal$1 || freeSelf$1 || Function('return this')();
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Gets the value at `key` of `object`.
|
|
154
|
-
*
|
|
155
|
-
* @private
|
|
156
|
-
* @param {Object} [object] The object to query.
|
|
157
|
-
* @param {string} key The key of the property to get.
|
|
158
|
-
* @returns {*} Returns the property value.
|
|
159
|
-
*/
|
|
160
|
-
function getValue$1(object, key) {
|
|
161
|
-
return object == null ? undefined : object[key];
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Checks if `value` is a host object in IE < 9.
|
|
166
|
-
*
|
|
167
|
-
* @private
|
|
168
|
-
* @param {*} value The value to check.
|
|
169
|
-
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
|
170
|
-
*/
|
|
171
|
-
function isHostObject$1(value) {
|
|
172
|
-
// Many host objects are `Object` objects that can coerce to strings
|
|
173
|
-
// despite having improperly defined `toString` methods.
|
|
174
|
-
var result = false;
|
|
175
|
-
if (value != null && typeof value.toString != 'function') {
|
|
176
|
-
try {
|
|
177
|
-
result = !!(value + '');
|
|
178
|
-
} catch (e) {}
|
|
179
|
-
}
|
|
180
|
-
return result;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/** Used for built-in method references. */
|
|
184
|
-
var arrayProto$1 = Array.prototype,
|
|
185
|
-
funcProto$1 = Function.prototype,
|
|
186
|
-
objectProto$1 = Object.prototype;
|
|
187
|
-
|
|
188
|
-
/** Used to detect overreaching core-js shims. */
|
|
189
|
-
var coreJsData$1 = root$1['__core-js_shared__'];
|
|
190
|
-
|
|
191
|
-
/** Used to detect methods masquerading as native. */
|
|
192
|
-
var maskSrcKey$1 = (function() {
|
|
193
|
-
var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || '');
|
|
194
|
-
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
195
|
-
}());
|
|
196
|
-
|
|
197
|
-
/** Used to resolve the decompiled source of functions. */
|
|
198
|
-
var funcToString$1 = funcProto$1.toString;
|
|
199
|
-
|
|
200
|
-
/** Used to check objects for own properties. */
|
|
201
|
-
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Used to resolve the
|
|
205
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
206
|
-
* of values.
|
|
207
|
-
*/
|
|
208
|
-
var objectToString$1 = objectProto$1.toString;
|
|
209
|
-
|
|
210
|
-
/** Used to detect if a method is native. */
|
|
211
|
-
var reIsNative$1 = RegExp('^' +
|
|
212
|
-
funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar$1, '\\$&')
|
|
213
|
-
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
/** Built-in value references. */
|
|
217
|
-
var Symbol$1 = root$1.Symbol,
|
|
218
|
-
splice$1 = arrayProto$1.splice;
|
|
219
|
-
|
|
220
|
-
/* Built-in method references that are verified to be native. */
|
|
221
|
-
var Map$1 = getNative$1(root$1, 'Map'),
|
|
222
|
-
nativeCreate$1 = getNative$1(Object, 'create');
|
|
223
|
-
|
|
224
|
-
/** Used to convert symbols to primitives and strings. */
|
|
225
|
-
var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : undefined,
|
|
226
|
-
symbolToString$1 = symbolProto$1 ? symbolProto$1.toString : undefined;
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Creates a hash object.
|
|
230
|
-
*
|
|
231
|
-
* @private
|
|
232
|
-
* @constructor
|
|
233
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
234
|
-
*/
|
|
235
|
-
function Hash$1(entries) {
|
|
236
|
-
var index = -1,
|
|
237
|
-
length = entries ? entries.length : 0;
|
|
238
|
-
|
|
239
|
-
this.clear();
|
|
240
|
-
while (++index < length) {
|
|
241
|
-
var entry = entries[index];
|
|
242
|
-
this.set(entry[0], entry[1]);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Removes all key-value entries from the hash.
|
|
248
|
-
*
|
|
249
|
-
* @private
|
|
250
|
-
* @name clear
|
|
251
|
-
* @memberOf Hash
|
|
252
|
-
*/
|
|
253
|
-
function hashClear$1() {
|
|
254
|
-
this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Removes `key` and its value from the hash.
|
|
259
|
-
*
|
|
260
|
-
* @private
|
|
261
|
-
* @name delete
|
|
262
|
-
* @memberOf Hash
|
|
263
|
-
* @param {Object} hash The hash to modify.
|
|
264
|
-
* @param {string} key The key of the value to remove.
|
|
265
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
266
|
-
*/
|
|
267
|
-
function hashDelete$1(key) {
|
|
268
|
-
return this.has(key) && delete this.__data__[key];
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Gets the hash value for `key`.
|
|
273
|
-
*
|
|
274
|
-
* @private
|
|
275
|
-
* @name get
|
|
276
|
-
* @memberOf Hash
|
|
277
|
-
* @param {string} key The key of the value to get.
|
|
278
|
-
* @returns {*} Returns the entry value.
|
|
279
|
-
*/
|
|
280
|
-
function hashGet$1(key) {
|
|
281
|
-
var data = this.__data__;
|
|
282
|
-
if (nativeCreate$1) {
|
|
283
|
-
var result = data[key];
|
|
284
|
-
return result === HASH_UNDEFINED$1 ? undefined : result;
|
|
285
|
-
}
|
|
286
|
-
return hasOwnProperty$1.call(data, key) ? data[key] : undefined;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Checks if a hash value for `key` exists.
|
|
291
|
-
*
|
|
292
|
-
* @private
|
|
293
|
-
* @name has
|
|
294
|
-
* @memberOf Hash
|
|
295
|
-
* @param {string} key The key of the entry to check.
|
|
296
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
297
|
-
*/
|
|
298
|
-
function hashHas$1(key) {
|
|
299
|
-
var data = this.__data__;
|
|
300
|
-
return nativeCreate$1 ? data[key] !== undefined : hasOwnProperty$1.call(data, key);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Sets the hash `key` to `value`.
|
|
305
|
-
*
|
|
306
|
-
* @private
|
|
307
|
-
* @name set
|
|
308
|
-
* @memberOf Hash
|
|
309
|
-
* @param {string} key The key of the value to set.
|
|
310
|
-
* @param {*} value The value to set.
|
|
311
|
-
* @returns {Object} Returns the hash instance.
|
|
312
|
-
*/
|
|
313
|
-
function hashSet$1(key, value) {
|
|
314
|
-
var data = this.__data__;
|
|
315
|
-
data[key] = (nativeCreate$1 && value === undefined) ? HASH_UNDEFINED$1 : value;
|
|
316
|
-
return this;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// Add methods to `Hash`.
|
|
320
|
-
Hash$1.prototype.clear = hashClear$1;
|
|
321
|
-
Hash$1.prototype['delete'] = hashDelete$1;
|
|
322
|
-
Hash$1.prototype.get = hashGet$1;
|
|
323
|
-
Hash$1.prototype.has = hashHas$1;
|
|
324
|
-
Hash$1.prototype.set = hashSet$1;
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Creates an list cache object.
|
|
328
|
-
*
|
|
329
|
-
* @private
|
|
330
|
-
* @constructor
|
|
331
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
332
|
-
*/
|
|
333
|
-
function ListCache$1(entries) {
|
|
334
|
-
var index = -1,
|
|
335
|
-
length = entries ? entries.length : 0;
|
|
336
|
-
|
|
337
|
-
this.clear();
|
|
338
|
-
while (++index < length) {
|
|
339
|
-
var entry = entries[index];
|
|
340
|
-
this.set(entry[0], entry[1]);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Removes all key-value entries from the list cache.
|
|
346
|
-
*
|
|
347
|
-
* @private
|
|
348
|
-
* @name clear
|
|
349
|
-
* @memberOf ListCache
|
|
350
|
-
*/
|
|
351
|
-
function listCacheClear$1() {
|
|
352
|
-
this.__data__ = [];
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* Removes `key` and its value from the list cache.
|
|
357
|
-
*
|
|
358
|
-
* @private
|
|
359
|
-
* @name delete
|
|
360
|
-
* @memberOf ListCache
|
|
361
|
-
* @param {string} key The key of the value to remove.
|
|
362
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
363
|
-
*/
|
|
364
|
-
function listCacheDelete$1(key) {
|
|
365
|
-
var data = this.__data__,
|
|
366
|
-
index = assocIndexOf$1(data, key);
|
|
367
|
-
|
|
368
|
-
if (index < 0) {
|
|
369
|
-
return false;
|
|
370
|
-
}
|
|
371
|
-
var lastIndex = data.length - 1;
|
|
372
|
-
if (index == lastIndex) {
|
|
373
|
-
data.pop();
|
|
374
|
-
} else {
|
|
375
|
-
splice$1.call(data, index, 1);
|
|
376
|
-
}
|
|
377
|
-
return true;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Gets the list cache value for `key`.
|
|
382
|
-
*
|
|
383
|
-
* @private
|
|
384
|
-
* @name get
|
|
385
|
-
* @memberOf ListCache
|
|
386
|
-
* @param {string} key The key of the value to get.
|
|
387
|
-
* @returns {*} Returns the entry value.
|
|
388
|
-
*/
|
|
389
|
-
function listCacheGet$1(key) {
|
|
390
|
-
var data = this.__data__,
|
|
391
|
-
index = assocIndexOf$1(data, key);
|
|
392
|
-
|
|
393
|
-
return index < 0 ? undefined : data[index][1];
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Checks if a list cache value for `key` exists.
|
|
398
|
-
*
|
|
399
|
-
* @private
|
|
400
|
-
* @name has
|
|
401
|
-
* @memberOf ListCache
|
|
402
|
-
* @param {string} key The key of the entry to check.
|
|
403
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
404
|
-
*/
|
|
405
|
-
function listCacheHas$1(key) {
|
|
406
|
-
return assocIndexOf$1(this.__data__, key) > -1;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Sets the list cache `key` to `value`.
|
|
411
|
-
*
|
|
412
|
-
* @private
|
|
413
|
-
* @name set
|
|
414
|
-
* @memberOf ListCache
|
|
415
|
-
* @param {string} key The key of the value to set.
|
|
416
|
-
* @param {*} value The value to set.
|
|
417
|
-
* @returns {Object} Returns the list cache instance.
|
|
418
|
-
*/
|
|
419
|
-
function listCacheSet$1(key, value) {
|
|
420
|
-
var data = this.__data__,
|
|
421
|
-
index = assocIndexOf$1(data, key);
|
|
422
|
-
|
|
423
|
-
if (index < 0) {
|
|
424
|
-
data.push([key, value]);
|
|
425
|
-
} else {
|
|
426
|
-
data[index][1] = value;
|
|
427
|
-
}
|
|
428
|
-
return this;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
// Add methods to `ListCache`.
|
|
432
|
-
ListCache$1.prototype.clear = listCacheClear$1;
|
|
433
|
-
ListCache$1.prototype['delete'] = listCacheDelete$1;
|
|
434
|
-
ListCache$1.prototype.get = listCacheGet$1;
|
|
435
|
-
ListCache$1.prototype.has = listCacheHas$1;
|
|
436
|
-
ListCache$1.prototype.set = listCacheSet$1;
|
|
437
|
-
|
|
438
|
-
/**
|
|
439
|
-
* Creates a map cache object to store key-value pairs.
|
|
440
|
-
*
|
|
441
|
-
* @private
|
|
442
|
-
* @constructor
|
|
443
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
444
|
-
*/
|
|
445
|
-
function MapCache$1(entries) {
|
|
446
|
-
var index = -1,
|
|
447
|
-
length = entries ? entries.length : 0;
|
|
448
|
-
|
|
449
|
-
this.clear();
|
|
450
|
-
while (++index < length) {
|
|
451
|
-
var entry = entries[index];
|
|
452
|
-
this.set(entry[0], entry[1]);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Removes all key-value entries from the map.
|
|
458
|
-
*
|
|
459
|
-
* @private
|
|
460
|
-
* @name clear
|
|
461
|
-
* @memberOf MapCache
|
|
462
|
-
*/
|
|
463
|
-
function mapCacheClear$1() {
|
|
464
|
-
this.__data__ = {
|
|
465
|
-
'hash': new Hash$1,
|
|
466
|
-
'map': new (Map$1 || ListCache$1),
|
|
467
|
-
'string': new Hash$1
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* Removes `key` and its value from the map.
|
|
473
|
-
*
|
|
474
|
-
* @private
|
|
475
|
-
* @name delete
|
|
476
|
-
* @memberOf MapCache
|
|
477
|
-
* @param {string} key The key of the value to remove.
|
|
478
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
479
|
-
*/
|
|
480
|
-
function mapCacheDelete$1(key) {
|
|
481
|
-
return getMapData$1(this, key)['delete'](key);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Gets the map value for `key`.
|
|
486
|
-
*
|
|
487
|
-
* @private
|
|
488
|
-
* @name get
|
|
489
|
-
* @memberOf MapCache
|
|
490
|
-
* @param {string} key The key of the value to get.
|
|
491
|
-
* @returns {*} Returns the entry value.
|
|
492
|
-
*/
|
|
493
|
-
function mapCacheGet$1(key) {
|
|
494
|
-
return getMapData$1(this, key).get(key);
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* Checks if a map value for `key` exists.
|
|
499
|
-
*
|
|
500
|
-
* @private
|
|
501
|
-
* @name has
|
|
502
|
-
* @memberOf MapCache
|
|
503
|
-
* @param {string} key The key of the entry to check.
|
|
504
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
505
|
-
*/
|
|
506
|
-
function mapCacheHas$1(key) {
|
|
507
|
-
return getMapData$1(this, key).has(key);
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
/**
|
|
511
|
-
* Sets the map `key` to `value`.
|
|
512
|
-
*
|
|
513
|
-
* @private
|
|
514
|
-
* @name set
|
|
515
|
-
* @memberOf MapCache
|
|
516
|
-
* @param {string} key The key of the value to set.
|
|
517
|
-
* @param {*} value The value to set.
|
|
518
|
-
* @returns {Object} Returns the map cache instance.
|
|
519
|
-
*/
|
|
520
|
-
function mapCacheSet$1(key, value) {
|
|
521
|
-
getMapData$1(this, key).set(key, value);
|
|
522
|
-
return this;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
// Add methods to `MapCache`.
|
|
526
|
-
MapCache$1.prototype.clear = mapCacheClear$1;
|
|
527
|
-
MapCache$1.prototype['delete'] = mapCacheDelete$1;
|
|
528
|
-
MapCache$1.prototype.get = mapCacheGet$1;
|
|
529
|
-
MapCache$1.prototype.has = mapCacheHas$1;
|
|
530
|
-
MapCache$1.prototype.set = mapCacheSet$1;
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
534
|
-
*
|
|
535
|
-
* @private
|
|
536
|
-
* @param {Array} array The array to inspect.
|
|
537
|
-
* @param {*} key The key to search for.
|
|
538
|
-
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
539
|
-
*/
|
|
540
|
-
function assocIndexOf$1(array, key) {
|
|
541
|
-
var length = array.length;
|
|
542
|
-
while (length--) {
|
|
543
|
-
if (eq$1(array[length][0], key)) {
|
|
544
|
-
return length;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
return -1;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
/**
|
|
551
|
-
* The base implementation of `_.isNative` without bad shim checks.
|
|
552
|
-
*
|
|
553
|
-
* @private
|
|
554
|
-
* @param {*} value The value to check.
|
|
555
|
-
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
556
|
-
* else `false`.
|
|
557
|
-
*/
|
|
558
|
-
function baseIsNative$1(value) {
|
|
559
|
-
if (!isObject$1(value) || isMasked$1(value)) {
|
|
560
|
-
return false;
|
|
561
|
-
}
|
|
562
|
-
var pattern = (isFunction$1(value) || isHostObject$1(value)) ? reIsNative$1 : reIsHostCtor$1;
|
|
563
|
-
return pattern.test(toSource$1(value));
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
/**
|
|
567
|
-
* The base implementation of `_.toString` which doesn't convert nullish
|
|
568
|
-
* values to empty strings.
|
|
569
|
-
*
|
|
570
|
-
* @private
|
|
571
|
-
* @param {*} value The value to process.
|
|
572
|
-
* @returns {string} Returns the string.
|
|
573
|
-
*/
|
|
574
|
-
function baseToString$1(value) {
|
|
575
|
-
// Exit early for strings to avoid a performance hit in some environments.
|
|
576
|
-
if (typeof value == 'string') {
|
|
577
|
-
return value;
|
|
578
|
-
}
|
|
579
|
-
if (isSymbol$1(value)) {
|
|
580
|
-
return symbolToString$1 ? symbolToString$1.call(value) : '';
|
|
581
|
-
}
|
|
582
|
-
var result = (value + '');
|
|
583
|
-
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* Casts `value` to a path array if it's not one.
|
|
588
|
-
*
|
|
589
|
-
* @private
|
|
590
|
-
* @param {*} value The value to inspect.
|
|
591
|
-
* @returns {Array} Returns the cast property path array.
|
|
592
|
-
*/
|
|
593
|
-
function castPath$1(value) {
|
|
594
|
-
return isArray$1(value) ? value : stringToPath$1(value);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* Gets the data for `map`.
|
|
599
|
-
*
|
|
600
|
-
* @private
|
|
601
|
-
* @param {Object} map The map to query.
|
|
602
|
-
* @param {string} key The reference key.
|
|
603
|
-
* @returns {*} Returns the map data.
|
|
604
|
-
*/
|
|
605
|
-
function getMapData$1(map, key) {
|
|
606
|
-
var data = map.__data__;
|
|
607
|
-
return isKeyable$1(key)
|
|
608
|
-
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
609
|
-
: data.map;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* Gets the native function at `key` of `object`.
|
|
614
|
-
*
|
|
615
|
-
* @private
|
|
616
|
-
* @param {Object} object The object to query.
|
|
617
|
-
* @param {string} key The key of the method to get.
|
|
618
|
-
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
619
|
-
*/
|
|
620
|
-
function getNative$1(object, key) {
|
|
621
|
-
var value = getValue$1(object, key);
|
|
622
|
-
return baseIsNative$1(value) ? value : undefined;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
* Checks if `value` is a property name and not a property path.
|
|
627
|
-
*
|
|
628
|
-
* @private
|
|
629
|
-
* @param {*} value The value to check.
|
|
630
|
-
* @param {Object} [object] The object to query keys on.
|
|
631
|
-
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
632
|
-
*/
|
|
633
|
-
function isKey$1(value, object) {
|
|
634
|
-
if (isArray$1(value)) {
|
|
635
|
-
return false;
|
|
636
|
-
}
|
|
637
|
-
var type = typeof value;
|
|
638
|
-
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
639
|
-
value == null || isSymbol$1(value)) {
|
|
640
|
-
return true;
|
|
641
|
-
}
|
|
642
|
-
return reIsPlainProp$1.test(value) || !reIsDeepProp$1.test(value) ||
|
|
643
|
-
(object != null && value in Object(object));
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* Checks if `value` is suitable for use as unique object key.
|
|
648
|
-
*
|
|
649
|
-
* @private
|
|
650
|
-
* @param {*} value The value to check.
|
|
651
|
-
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
652
|
-
*/
|
|
653
|
-
function isKeyable$1(value) {
|
|
654
|
-
var type = typeof value;
|
|
655
|
-
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
656
|
-
? (value !== '__proto__')
|
|
657
|
-
: (value === null);
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
/**
|
|
661
|
-
* Checks if `func` has its source masked.
|
|
662
|
-
*
|
|
663
|
-
* @private
|
|
664
|
-
* @param {Function} func The function to check.
|
|
665
|
-
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
666
|
-
*/
|
|
667
|
-
function isMasked$1(func) {
|
|
668
|
-
return !!maskSrcKey$1 && (maskSrcKey$1 in func);
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
/**
|
|
672
|
-
* Converts `string` to a property path array.
|
|
673
|
-
*
|
|
674
|
-
* @private
|
|
675
|
-
* @param {string} string The string to convert.
|
|
676
|
-
* @returns {Array} Returns the property path array.
|
|
677
|
-
*/
|
|
678
|
-
var stringToPath$1 = memoize$1(function(string) {
|
|
679
|
-
string = toString$1(string);
|
|
680
|
-
|
|
681
|
-
var result = [];
|
|
682
|
-
if (reLeadingDot$1.test(string)) {
|
|
683
|
-
result.push('');
|
|
684
|
-
}
|
|
685
|
-
string.replace(rePropName$1, function(match, number, quote, string) {
|
|
686
|
-
result.push(quote ? string.replace(reEscapeChar$1, '$1') : (number || match));
|
|
687
|
-
});
|
|
688
|
-
return result;
|
|
689
|
-
});
|
|
690
|
-
|
|
691
|
-
/**
|
|
692
|
-
* Converts `value` to a string key if it's not a string or symbol.
|
|
693
|
-
*
|
|
694
|
-
* @private
|
|
695
|
-
* @param {*} value The value to inspect.
|
|
696
|
-
* @returns {string|symbol} Returns the key.
|
|
697
|
-
*/
|
|
698
|
-
function toKey$1(value) {
|
|
699
|
-
if (typeof value == 'string' || isSymbol$1(value)) {
|
|
700
|
-
return value;
|
|
701
|
-
}
|
|
702
|
-
var result = (value + '');
|
|
703
|
-
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* Converts `func` to its source code.
|
|
708
|
-
*
|
|
709
|
-
* @private
|
|
710
|
-
* @param {Function} func The function to process.
|
|
711
|
-
* @returns {string} Returns the source code.
|
|
712
|
-
*/
|
|
713
|
-
function toSource$1(func) {
|
|
714
|
-
if (func != null) {
|
|
715
|
-
try {
|
|
716
|
-
return funcToString$1.call(func);
|
|
717
|
-
} catch (e) {}
|
|
718
|
-
try {
|
|
719
|
-
return (func + '');
|
|
720
|
-
} catch (e) {}
|
|
721
|
-
}
|
|
722
|
-
return '';
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
/**
|
|
726
|
-
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
727
|
-
* provided, it determines the cache key for storing the result based on the
|
|
728
|
-
* arguments provided to the memoized function. By default, the first argument
|
|
729
|
-
* provided to the memoized function is used as the map cache key. The `func`
|
|
730
|
-
* is invoked with the `this` binding of the memoized function.
|
|
731
|
-
*
|
|
732
|
-
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
733
|
-
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
734
|
-
* constructor with one whose instances implement the
|
|
735
|
-
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
736
|
-
* method interface of `delete`, `get`, `has`, and `set`.
|
|
737
|
-
*
|
|
738
|
-
* @static
|
|
739
|
-
* @memberOf _
|
|
740
|
-
* @since 0.1.0
|
|
741
|
-
* @category Function
|
|
742
|
-
* @param {Function} func The function to have its output memoized.
|
|
743
|
-
* @param {Function} [resolver] The function to resolve the cache key.
|
|
744
|
-
* @returns {Function} Returns the new memoized function.
|
|
745
|
-
* @example
|
|
746
|
-
*
|
|
747
|
-
* var object = { 'a': 1, 'b': 2 };
|
|
748
|
-
* var other = { 'c': 3, 'd': 4 };
|
|
749
|
-
*
|
|
750
|
-
* var values = _.memoize(_.values);
|
|
751
|
-
* values(object);
|
|
752
|
-
* // => [1, 2]
|
|
753
|
-
*
|
|
754
|
-
* values(other);
|
|
755
|
-
* // => [3, 4]
|
|
756
|
-
*
|
|
757
|
-
* object.a = 2;
|
|
758
|
-
* values(object);
|
|
759
|
-
* // => [1, 2]
|
|
760
|
-
*
|
|
761
|
-
* // Modify the result cache.
|
|
762
|
-
* values.cache.set(object, ['a', 'b']);
|
|
763
|
-
* values(object);
|
|
764
|
-
* // => ['a', 'b']
|
|
765
|
-
*
|
|
766
|
-
* // Replace `_.memoize.Cache`.
|
|
767
|
-
* _.memoize.Cache = WeakMap;
|
|
768
|
-
*/
|
|
769
|
-
function memoize$1(func, resolver) {
|
|
770
|
-
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
|
|
771
|
-
throw new TypeError(FUNC_ERROR_TEXT$1);
|
|
772
|
-
}
|
|
773
|
-
var memoized = function() {
|
|
774
|
-
var args = arguments,
|
|
775
|
-
key = resolver ? resolver.apply(this, args) : args[0],
|
|
776
|
-
cache = memoized.cache;
|
|
777
|
-
|
|
778
|
-
if (cache.has(key)) {
|
|
779
|
-
return cache.get(key);
|
|
780
|
-
}
|
|
781
|
-
var result = func.apply(this, args);
|
|
782
|
-
memoized.cache = cache.set(key, result);
|
|
783
|
-
return result;
|
|
784
|
-
};
|
|
785
|
-
memoized.cache = new (memoize$1.Cache || MapCache$1);
|
|
786
|
-
return memoized;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
// Assign cache to `_.memoize`.
|
|
790
|
-
memoize$1.Cache = MapCache$1;
|
|
791
|
-
|
|
792
|
-
/**
|
|
793
|
-
* Performs a
|
|
794
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
795
|
-
* comparison between two values to determine if they are equivalent.
|
|
796
|
-
*
|
|
797
|
-
* @static
|
|
798
|
-
* @memberOf _
|
|
799
|
-
* @since 4.0.0
|
|
800
|
-
* @category Lang
|
|
801
|
-
* @param {*} value The value to compare.
|
|
802
|
-
* @param {*} other The other value to compare.
|
|
803
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
804
|
-
* @example
|
|
805
|
-
*
|
|
806
|
-
* var object = { 'a': 1 };
|
|
807
|
-
* var other = { 'a': 1 };
|
|
808
|
-
*
|
|
809
|
-
* _.eq(object, object);
|
|
810
|
-
* // => true
|
|
811
|
-
*
|
|
812
|
-
* _.eq(object, other);
|
|
813
|
-
* // => false
|
|
814
|
-
*
|
|
815
|
-
* _.eq('a', 'a');
|
|
816
|
-
* // => true
|
|
817
|
-
*
|
|
818
|
-
* _.eq('a', Object('a'));
|
|
819
|
-
* // => false
|
|
820
|
-
*
|
|
821
|
-
* _.eq(NaN, NaN);
|
|
822
|
-
* // => true
|
|
823
|
-
*/
|
|
824
|
-
function eq$1(value, other) {
|
|
825
|
-
return value === other || (value !== value && other !== other);
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
/**
|
|
829
|
-
* Checks if `value` is classified as an `Array` object.
|
|
830
|
-
*
|
|
831
|
-
* @static
|
|
832
|
-
* @memberOf _
|
|
833
|
-
* @since 0.1.0
|
|
834
|
-
* @category Lang
|
|
835
|
-
* @param {*} value The value to check.
|
|
836
|
-
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
837
|
-
* @example
|
|
838
|
-
*
|
|
839
|
-
* _.isArray([1, 2, 3]);
|
|
840
|
-
* // => true
|
|
841
|
-
*
|
|
842
|
-
* _.isArray(document.body.children);
|
|
843
|
-
* // => false
|
|
844
|
-
*
|
|
845
|
-
* _.isArray('abc');
|
|
846
|
-
* // => false
|
|
847
|
-
*
|
|
848
|
-
* _.isArray(_.noop);
|
|
849
|
-
* // => false
|
|
850
|
-
*/
|
|
851
|
-
var isArray$1 = Array.isArray;
|
|
852
|
-
|
|
853
|
-
/**
|
|
854
|
-
* Checks if `value` is classified as a `Function` object.
|
|
855
|
-
*
|
|
856
|
-
* @static
|
|
857
|
-
* @memberOf _
|
|
858
|
-
* @since 0.1.0
|
|
859
|
-
* @category Lang
|
|
860
|
-
* @param {*} value The value to check.
|
|
861
|
-
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
862
|
-
* @example
|
|
863
|
-
*
|
|
864
|
-
* _.isFunction(_);
|
|
865
|
-
* // => true
|
|
866
|
-
*
|
|
867
|
-
* _.isFunction(/abc/);
|
|
868
|
-
* // => false
|
|
869
|
-
*/
|
|
870
|
-
function isFunction$1(value) {
|
|
871
|
-
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
872
|
-
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
|
873
|
-
var tag = isObject$1(value) ? objectToString$1.call(value) : '';
|
|
874
|
-
return tag == funcTag$1 || tag == genTag$1;
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
/**
|
|
878
|
-
* Checks if `value` is the
|
|
879
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
880
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
881
|
-
*
|
|
882
|
-
* @static
|
|
883
|
-
* @memberOf _
|
|
884
|
-
* @since 0.1.0
|
|
885
|
-
* @category Lang
|
|
886
|
-
* @param {*} value The value to check.
|
|
887
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
888
|
-
* @example
|
|
889
|
-
*
|
|
890
|
-
* _.isObject({});
|
|
891
|
-
* // => true
|
|
892
|
-
*
|
|
893
|
-
* _.isObject([1, 2, 3]);
|
|
894
|
-
* // => true
|
|
895
|
-
*
|
|
896
|
-
* _.isObject(_.noop);
|
|
897
|
-
* // => true
|
|
898
|
-
*
|
|
899
|
-
* _.isObject(null);
|
|
900
|
-
* // => false
|
|
901
|
-
*/
|
|
902
|
-
function isObject$1(value) {
|
|
903
|
-
var type = typeof value;
|
|
904
|
-
return !!value && (type == 'object' || type == 'function');
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
/**
|
|
908
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
909
|
-
* and has a `typeof` result of "object".
|
|
910
|
-
*
|
|
911
|
-
* @static
|
|
912
|
-
* @memberOf _
|
|
913
|
-
* @since 4.0.0
|
|
914
|
-
* @category Lang
|
|
915
|
-
* @param {*} value The value to check.
|
|
916
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
917
|
-
* @example
|
|
918
|
-
*
|
|
919
|
-
* _.isObjectLike({});
|
|
920
|
-
* // => true
|
|
921
|
-
*
|
|
922
|
-
* _.isObjectLike([1, 2, 3]);
|
|
923
|
-
* // => true
|
|
924
|
-
*
|
|
925
|
-
* _.isObjectLike(_.noop);
|
|
926
|
-
* // => false
|
|
927
|
-
*
|
|
928
|
-
* _.isObjectLike(null);
|
|
929
|
-
* // => false
|
|
930
|
-
*/
|
|
931
|
-
function isObjectLike$1(value) {
|
|
932
|
-
return !!value && typeof value == 'object';
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
/**
|
|
936
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
937
|
-
*
|
|
938
|
-
* @static
|
|
939
|
-
* @memberOf _
|
|
940
|
-
* @since 4.0.0
|
|
941
|
-
* @category Lang
|
|
942
|
-
* @param {*} value The value to check.
|
|
943
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
944
|
-
* @example
|
|
945
|
-
*
|
|
946
|
-
* _.isSymbol(Symbol.iterator);
|
|
947
|
-
* // => true
|
|
948
|
-
*
|
|
949
|
-
* _.isSymbol('abc');
|
|
950
|
-
* // => false
|
|
951
|
-
*/
|
|
952
|
-
function isSymbol$1(value) {
|
|
953
|
-
return typeof value == 'symbol' ||
|
|
954
|
-
(isObjectLike$1(value) && objectToString$1.call(value) == symbolTag$1);
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
/**
|
|
958
|
-
* Converts `value` to a string. An empty string is returned for `null`
|
|
959
|
-
* and `undefined` values. The sign of `-0` is preserved.
|
|
960
|
-
*
|
|
961
|
-
* @static
|
|
962
|
-
* @memberOf _
|
|
963
|
-
* @since 4.0.0
|
|
964
|
-
* @category Lang
|
|
965
|
-
* @param {*} value The value to process.
|
|
966
|
-
* @returns {string} Returns the string.
|
|
967
|
-
* @example
|
|
968
|
-
*
|
|
969
|
-
* _.toString(null);
|
|
970
|
-
* // => ''
|
|
971
|
-
*
|
|
972
|
-
* _.toString(-0);
|
|
973
|
-
* // => '-0'
|
|
974
|
-
*
|
|
975
|
-
* _.toString([1, 2, 3]);
|
|
976
|
-
* // => '1,2,3'
|
|
977
|
-
*/
|
|
978
|
-
function toString$1(value) {
|
|
979
|
-
return value == null ? '' : baseToString$1(value);
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
/**
|
|
983
|
-
* This method is like `_.get` except that if the resolved value is a
|
|
984
|
-
* function it's invoked with the `this` binding of its parent object and
|
|
985
|
-
* its result is returned.
|
|
986
|
-
*
|
|
987
|
-
* @static
|
|
988
|
-
* @since 0.1.0
|
|
989
|
-
* @memberOf _
|
|
990
|
-
* @category Object
|
|
991
|
-
* @param {Object} object The object to query.
|
|
992
|
-
* @param {Array|string} path The path of the property to resolve.
|
|
993
|
-
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
994
|
-
* @returns {*} Returns the resolved value.
|
|
995
|
-
* @example
|
|
996
|
-
*
|
|
997
|
-
* var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
|
|
998
|
-
*
|
|
999
|
-
* _.result(object, 'a[0].b.c1');
|
|
1000
|
-
* // => 3
|
|
1001
|
-
*
|
|
1002
|
-
* _.result(object, 'a[0].b.c2');
|
|
1003
|
-
* // => 4
|
|
1004
|
-
*
|
|
1005
|
-
* _.result(object, 'a[0].b.c3', 'default');
|
|
1006
|
-
* // => 'default'
|
|
1007
|
-
*
|
|
1008
|
-
* _.result(object, 'a[0].b.c3', _.constant('default'));
|
|
1009
|
-
* // => 'default'
|
|
1010
|
-
*/
|
|
1011
|
-
function result(object, path, defaultValue) {
|
|
1012
|
-
path = isKey$1(path, object) ? [path] : castPath$1(path);
|
|
1013
|
-
|
|
1014
|
-
var index = -1,
|
|
1015
|
-
length = path.length;
|
|
1016
|
-
|
|
1017
|
-
// Ensure the loop is entered when path is empty.
|
|
1018
|
-
if (!length) {
|
|
1019
|
-
object = undefined;
|
|
1020
|
-
length = 1;
|
|
1021
|
-
}
|
|
1022
|
-
while (++index < length) {
|
|
1023
|
-
var value = object == null ? undefined : object[toKey$1(path[index])];
|
|
1024
|
-
if (value === undefined) {
|
|
1025
|
-
index = length;
|
|
1026
|
-
value = defaultValue;
|
|
1027
|
-
}
|
|
1028
|
-
object = isFunction$1(value) ? value.call(object) : value;
|
|
1029
|
-
}
|
|
1030
|
-
return object;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
var lodash_result = result;
|
|
1034
|
-
|
|
1035
|
-
/**
|
|
1036
|
-
* lodash (Custom Build) <https://lodash.com/>
|
|
1037
|
-
* Build: `lodash modularize exports="npm" -o ./`
|
|
1038
|
-
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
1039
|
-
* Released under MIT license <https://lodash.com/license>
|
|
1040
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
1041
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
1042
|
-
*/
|
|
1043
|
-
|
|
1044
|
-
/** Used as the `TypeError` message for "Functions" methods. */
|
|
1045
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
1046
|
-
|
|
1047
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
1048
|
-
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
1049
|
-
|
|
1050
|
-
/** Used as references for various `Number` constants. */
|
|
1051
|
-
var INFINITY = 1 / 0,
|
|
1052
|
-
MAX_SAFE_INTEGER = 9007199254740991;
|
|
1053
|
-
|
|
1054
|
-
/** `Object#toString` result references. */
|
|
1055
|
-
var funcTag = '[object Function]',
|
|
1056
|
-
genTag = '[object GeneratorFunction]',
|
|
1057
|
-
symbolTag = '[object Symbol]';
|
|
1058
|
-
|
|
1059
|
-
/** Used to match property names within property paths. */
|
|
1060
|
-
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
1061
|
-
reIsPlainProp = /^\w*$/,
|
|
1062
|
-
reLeadingDot = /^\./,
|
|
1063
|
-
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
1064
|
-
|
|
1065
|
-
/**
|
|
1066
|
-
* Used to match `RegExp`
|
|
1067
|
-
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
1068
|
-
*/
|
|
1069
|
-
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
1070
|
-
|
|
1071
|
-
/** Used to match backslashes in property paths. */
|
|
1072
|
-
var reEscapeChar = /\\(\\)?/g;
|
|
1073
|
-
|
|
1074
|
-
/** Used to detect host constructors (Safari). */
|
|
1075
|
-
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
1076
|
-
|
|
1077
|
-
/** Used to detect unsigned integer values. */
|
|
1078
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
1079
|
-
|
|
1080
|
-
/** Detect free variable `global` from Node.js. */
|
|
1081
|
-
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
1082
|
-
|
|
1083
|
-
/** Detect free variable `self`. */
|
|
1084
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
1085
|
-
|
|
1086
|
-
/** Used as a reference to the global object. */
|
|
1087
|
-
var root = freeGlobal || freeSelf || Function('return this')();
|
|
1088
|
-
|
|
1089
|
-
/**
|
|
1090
|
-
* Gets the value at `key` of `object`.
|
|
1091
|
-
*
|
|
1092
|
-
* @private
|
|
1093
|
-
* @param {Object} [object] The object to query.
|
|
1094
|
-
* @param {string} key The key of the property to get.
|
|
1095
|
-
* @returns {*} Returns the property value.
|
|
1096
|
-
*/
|
|
1097
|
-
function getValue(object, key) {
|
|
1098
|
-
return object == null ? undefined : object[key];
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
/**
|
|
1102
|
-
* Checks if `value` is a host object in IE < 9.
|
|
1103
|
-
*
|
|
1104
|
-
* @private
|
|
1105
|
-
* @param {*} value The value to check.
|
|
1106
|
-
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
|
1107
|
-
*/
|
|
1108
|
-
function isHostObject(value) {
|
|
1109
|
-
// Many host objects are `Object` objects that can coerce to strings
|
|
1110
|
-
// despite having improperly defined `toString` methods.
|
|
1111
|
-
var result = false;
|
|
1112
|
-
if (value != null && typeof value.toString != 'function') {
|
|
1113
|
-
try {
|
|
1114
|
-
result = !!(value + '');
|
|
1115
|
-
} catch (e) {}
|
|
1116
|
-
}
|
|
1117
|
-
return result;
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
/** Used for built-in method references. */
|
|
1121
|
-
var arrayProto = Array.prototype,
|
|
1122
|
-
funcProto = Function.prototype,
|
|
1123
|
-
objectProto = Object.prototype;
|
|
1124
|
-
|
|
1125
|
-
/** Used to detect overreaching core-js shims. */
|
|
1126
|
-
var coreJsData = root['__core-js_shared__'];
|
|
1127
|
-
|
|
1128
|
-
/** Used to detect methods masquerading as native. */
|
|
1129
|
-
var maskSrcKey = (function() {
|
|
1130
|
-
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
1131
|
-
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
1132
|
-
}());
|
|
1133
|
-
|
|
1134
|
-
/** Used to resolve the decompiled source of functions. */
|
|
1135
|
-
var funcToString = funcProto.toString;
|
|
1136
|
-
|
|
1137
|
-
/** Used to check objects for own properties. */
|
|
1138
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1139
|
-
|
|
1140
|
-
/**
|
|
1141
|
-
* Used to resolve the
|
|
1142
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
1143
|
-
* of values.
|
|
1144
|
-
*/
|
|
1145
|
-
var objectToString = objectProto.toString;
|
|
1146
|
-
|
|
1147
|
-
/** Used to detect if a method is native. */
|
|
1148
|
-
var reIsNative = RegExp('^' +
|
|
1149
|
-
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
|
1150
|
-
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
1151
|
-
);
|
|
1152
|
-
|
|
1153
|
-
/** Built-in value references. */
|
|
1154
|
-
var Symbol = root.Symbol,
|
|
1155
|
-
splice = arrayProto.splice;
|
|
1156
|
-
|
|
1157
|
-
/* Built-in method references that are verified to be native. */
|
|
1158
|
-
var Map = getNative(root, 'Map'),
|
|
1159
|
-
nativeCreate = getNative(Object, 'create');
|
|
1160
|
-
|
|
1161
|
-
/** Used to convert symbols to primitives and strings. */
|
|
1162
|
-
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
1163
|
-
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
1164
|
-
|
|
1165
|
-
/**
|
|
1166
|
-
* Creates a hash object.
|
|
1167
|
-
*
|
|
1168
|
-
* @private
|
|
1169
|
-
* @constructor
|
|
1170
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1171
|
-
*/
|
|
1172
|
-
function Hash(entries) {
|
|
1173
|
-
var index = -1,
|
|
1174
|
-
length = entries ? entries.length : 0;
|
|
1175
|
-
|
|
1176
|
-
this.clear();
|
|
1177
|
-
while (++index < length) {
|
|
1178
|
-
var entry = entries[index];
|
|
1179
|
-
this.set(entry[0], entry[1]);
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
/**
|
|
1184
|
-
* Removes all key-value entries from the hash.
|
|
1185
|
-
*
|
|
1186
|
-
* @private
|
|
1187
|
-
* @name clear
|
|
1188
|
-
* @memberOf Hash
|
|
1189
|
-
*/
|
|
1190
|
-
function hashClear() {
|
|
1191
|
-
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
/**
|
|
1195
|
-
* Removes `key` and its value from the hash.
|
|
1196
|
-
*
|
|
1197
|
-
* @private
|
|
1198
|
-
* @name delete
|
|
1199
|
-
* @memberOf Hash
|
|
1200
|
-
* @param {Object} hash The hash to modify.
|
|
1201
|
-
* @param {string} key The key of the value to remove.
|
|
1202
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1203
|
-
*/
|
|
1204
|
-
function hashDelete(key) {
|
|
1205
|
-
return this.has(key) && delete this.__data__[key];
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
/**
|
|
1209
|
-
* Gets the hash value for `key`.
|
|
1210
|
-
*
|
|
1211
|
-
* @private
|
|
1212
|
-
* @name get
|
|
1213
|
-
* @memberOf Hash
|
|
1214
|
-
* @param {string} key The key of the value to get.
|
|
1215
|
-
* @returns {*} Returns the entry value.
|
|
1216
|
-
*/
|
|
1217
|
-
function hashGet(key) {
|
|
1218
|
-
var data = this.__data__;
|
|
1219
|
-
if (nativeCreate) {
|
|
1220
|
-
var result = data[key];
|
|
1221
|
-
return result === HASH_UNDEFINED ? undefined : result;
|
|
1222
|
-
}
|
|
1223
|
-
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
/**
|
|
1227
|
-
* Checks if a hash value for `key` exists.
|
|
1228
|
-
*
|
|
1229
|
-
* @private
|
|
1230
|
-
* @name has
|
|
1231
|
-
* @memberOf Hash
|
|
1232
|
-
* @param {string} key The key of the entry to check.
|
|
1233
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1234
|
-
*/
|
|
1235
|
-
function hashHas(key) {
|
|
1236
|
-
var data = this.__data__;
|
|
1237
|
-
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
/**
|
|
1241
|
-
* Sets the hash `key` to `value`.
|
|
1242
|
-
*
|
|
1243
|
-
* @private
|
|
1244
|
-
* @name set
|
|
1245
|
-
* @memberOf Hash
|
|
1246
|
-
* @param {string} key The key of the value to set.
|
|
1247
|
-
* @param {*} value The value to set.
|
|
1248
|
-
* @returns {Object} Returns the hash instance.
|
|
1249
|
-
*/
|
|
1250
|
-
function hashSet(key, value) {
|
|
1251
|
-
var data = this.__data__;
|
|
1252
|
-
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
1253
|
-
return this;
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
// Add methods to `Hash`.
|
|
1257
|
-
Hash.prototype.clear = hashClear;
|
|
1258
|
-
Hash.prototype['delete'] = hashDelete;
|
|
1259
|
-
Hash.prototype.get = hashGet;
|
|
1260
|
-
Hash.prototype.has = hashHas;
|
|
1261
|
-
Hash.prototype.set = hashSet;
|
|
1262
|
-
|
|
1263
|
-
/**
|
|
1264
|
-
* Creates an list cache object.
|
|
1265
|
-
*
|
|
1266
|
-
* @private
|
|
1267
|
-
* @constructor
|
|
1268
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1269
|
-
*/
|
|
1270
|
-
function ListCache(entries) {
|
|
1271
|
-
var index = -1,
|
|
1272
|
-
length = entries ? entries.length : 0;
|
|
1273
|
-
|
|
1274
|
-
this.clear();
|
|
1275
|
-
while (++index < length) {
|
|
1276
|
-
var entry = entries[index];
|
|
1277
|
-
this.set(entry[0], entry[1]);
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
/**
|
|
1282
|
-
* Removes all key-value entries from the list cache.
|
|
1283
|
-
*
|
|
1284
|
-
* @private
|
|
1285
|
-
* @name clear
|
|
1286
|
-
* @memberOf ListCache
|
|
1287
|
-
*/
|
|
1288
|
-
function listCacheClear() {
|
|
1289
|
-
this.__data__ = [];
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
/**
|
|
1293
|
-
* Removes `key` and its value from the list cache.
|
|
1294
|
-
*
|
|
1295
|
-
* @private
|
|
1296
|
-
* @name delete
|
|
1297
|
-
* @memberOf ListCache
|
|
1298
|
-
* @param {string} key The key of the value to remove.
|
|
1299
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1300
|
-
*/
|
|
1301
|
-
function listCacheDelete(key) {
|
|
1302
|
-
var data = this.__data__,
|
|
1303
|
-
index = assocIndexOf(data, key);
|
|
1304
|
-
|
|
1305
|
-
if (index < 0) {
|
|
1306
|
-
return false;
|
|
1307
|
-
}
|
|
1308
|
-
var lastIndex = data.length - 1;
|
|
1309
|
-
if (index == lastIndex) {
|
|
1310
|
-
data.pop();
|
|
1311
|
-
} else {
|
|
1312
|
-
splice.call(data, index, 1);
|
|
1313
|
-
}
|
|
1314
|
-
return true;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
/**
|
|
1318
|
-
* Gets the list cache value for `key`.
|
|
1319
|
-
*
|
|
1320
|
-
* @private
|
|
1321
|
-
* @name get
|
|
1322
|
-
* @memberOf ListCache
|
|
1323
|
-
* @param {string} key The key of the value to get.
|
|
1324
|
-
* @returns {*} Returns the entry value.
|
|
1325
|
-
*/
|
|
1326
|
-
function listCacheGet(key) {
|
|
1327
|
-
var data = this.__data__,
|
|
1328
|
-
index = assocIndexOf(data, key);
|
|
1329
|
-
|
|
1330
|
-
return index < 0 ? undefined : data[index][1];
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
/**
|
|
1334
|
-
* Checks if a list cache value for `key` exists.
|
|
1335
|
-
*
|
|
1336
|
-
* @private
|
|
1337
|
-
* @name has
|
|
1338
|
-
* @memberOf ListCache
|
|
1339
|
-
* @param {string} key The key of the entry to check.
|
|
1340
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1341
|
-
*/
|
|
1342
|
-
function listCacheHas(key) {
|
|
1343
|
-
return assocIndexOf(this.__data__, key) > -1;
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
/**
|
|
1347
|
-
* Sets the list cache `key` to `value`.
|
|
1348
|
-
*
|
|
1349
|
-
* @private
|
|
1350
|
-
* @name set
|
|
1351
|
-
* @memberOf ListCache
|
|
1352
|
-
* @param {string} key The key of the value to set.
|
|
1353
|
-
* @param {*} value The value to set.
|
|
1354
|
-
* @returns {Object} Returns the list cache instance.
|
|
1355
|
-
*/
|
|
1356
|
-
function listCacheSet(key, value) {
|
|
1357
|
-
var data = this.__data__,
|
|
1358
|
-
index = assocIndexOf(data, key);
|
|
1359
|
-
|
|
1360
|
-
if (index < 0) {
|
|
1361
|
-
data.push([key, value]);
|
|
1362
|
-
} else {
|
|
1363
|
-
data[index][1] = value;
|
|
1364
|
-
}
|
|
1365
|
-
return this;
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
// Add methods to `ListCache`.
|
|
1369
|
-
ListCache.prototype.clear = listCacheClear;
|
|
1370
|
-
ListCache.prototype['delete'] = listCacheDelete;
|
|
1371
|
-
ListCache.prototype.get = listCacheGet;
|
|
1372
|
-
ListCache.prototype.has = listCacheHas;
|
|
1373
|
-
ListCache.prototype.set = listCacheSet;
|
|
1374
|
-
|
|
1375
|
-
/**
|
|
1376
|
-
* Creates a map cache object to store key-value pairs.
|
|
1377
|
-
*
|
|
1378
|
-
* @private
|
|
1379
|
-
* @constructor
|
|
1380
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1381
|
-
*/
|
|
1382
|
-
function MapCache(entries) {
|
|
1383
|
-
var index = -1,
|
|
1384
|
-
length = entries ? entries.length : 0;
|
|
1385
|
-
|
|
1386
|
-
this.clear();
|
|
1387
|
-
while (++index < length) {
|
|
1388
|
-
var entry = entries[index];
|
|
1389
|
-
this.set(entry[0], entry[1]);
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
/**
|
|
1394
|
-
* Removes all key-value entries from the map.
|
|
1395
|
-
*
|
|
1396
|
-
* @private
|
|
1397
|
-
* @name clear
|
|
1398
|
-
* @memberOf MapCache
|
|
1399
|
-
*/
|
|
1400
|
-
function mapCacheClear() {
|
|
1401
|
-
this.__data__ = {
|
|
1402
|
-
'hash': new Hash,
|
|
1403
|
-
'map': new (Map || ListCache),
|
|
1404
|
-
'string': new Hash
|
|
1405
|
-
};
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
/**
|
|
1409
|
-
* Removes `key` and its value from the map.
|
|
1410
|
-
*
|
|
1411
|
-
* @private
|
|
1412
|
-
* @name delete
|
|
1413
|
-
* @memberOf MapCache
|
|
1414
|
-
* @param {string} key The key of the value to remove.
|
|
1415
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1416
|
-
*/
|
|
1417
|
-
function mapCacheDelete(key) {
|
|
1418
|
-
return getMapData(this, key)['delete'](key);
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
/**
|
|
1422
|
-
* Gets the map value for `key`.
|
|
1423
|
-
*
|
|
1424
|
-
* @private
|
|
1425
|
-
* @name get
|
|
1426
|
-
* @memberOf MapCache
|
|
1427
|
-
* @param {string} key The key of the value to get.
|
|
1428
|
-
* @returns {*} Returns the entry value.
|
|
1429
|
-
*/
|
|
1430
|
-
function mapCacheGet(key) {
|
|
1431
|
-
return getMapData(this, key).get(key);
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
/**
|
|
1435
|
-
* Checks if a map value for `key` exists.
|
|
1436
|
-
*
|
|
1437
|
-
* @private
|
|
1438
|
-
* @name has
|
|
1439
|
-
* @memberOf MapCache
|
|
1440
|
-
* @param {string} key The key of the entry to check.
|
|
1441
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1442
|
-
*/
|
|
1443
|
-
function mapCacheHas(key) {
|
|
1444
|
-
return getMapData(this, key).has(key);
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
/**
|
|
1448
|
-
* Sets the map `key` to `value`.
|
|
1449
|
-
*
|
|
1450
|
-
* @private
|
|
1451
|
-
* @name set
|
|
1452
|
-
* @memberOf MapCache
|
|
1453
|
-
* @param {string} key The key of the value to set.
|
|
1454
|
-
* @param {*} value The value to set.
|
|
1455
|
-
* @returns {Object} Returns the map cache instance.
|
|
1456
|
-
*/
|
|
1457
|
-
function mapCacheSet(key, value) {
|
|
1458
|
-
getMapData(this, key).set(key, value);
|
|
1459
|
-
return this;
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
// Add methods to `MapCache`.
|
|
1463
|
-
MapCache.prototype.clear = mapCacheClear;
|
|
1464
|
-
MapCache.prototype['delete'] = mapCacheDelete;
|
|
1465
|
-
MapCache.prototype.get = mapCacheGet;
|
|
1466
|
-
MapCache.prototype.has = mapCacheHas;
|
|
1467
|
-
MapCache.prototype.set = mapCacheSet;
|
|
1468
|
-
|
|
1469
|
-
/**
|
|
1470
|
-
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
1471
|
-
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
1472
|
-
* for equality comparisons.
|
|
1473
|
-
*
|
|
1474
|
-
* @private
|
|
1475
|
-
* @param {Object} object The object to modify.
|
|
1476
|
-
* @param {string} key The key of the property to assign.
|
|
1477
|
-
* @param {*} value The value to assign.
|
|
1478
|
-
*/
|
|
1479
|
-
function assignValue(object, key, value) {
|
|
1480
|
-
var objValue = object[key];
|
|
1481
|
-
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
|
1482
|
-
(value === undefined && !(key in object))) {
|
|
1483
|
-
object[key] = value;
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
/**
|
|
1488
|
-
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
1489
|
-
*
|
|
1490
|
-
* @private
|
|
1491
|
-
* @param {Array} array The array to inspect.
|
|
1492
|
-
* @param {*} key The key to search for.
|
|
1493
|
-
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1494
|
-
*/
|
|
1495
|
-
function assocIndexOf(array, key) {
|
|
1496
|
-
var length = array.length;
|
|
1497
|
-
while (length--) {
|
|
1498
|
-
if (eq(array[length][0], key)) {
|
|
1499
|
-
return length;
|
|
1500
|
-
}
|
|
1501
|
-
}
|
|
1502
|
-
return -1;
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
/**
|
|
1506
|
-
* The base implementation of `_.isNative` without bad shim checks.
|
|
1507
|
-
*
|
|
1508
|
-
* @private
|
|
1509
|
-
* @param {*} value The value to check.
|
|
1510
|
-
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
1511
|
-
* else `false`.
|
|
1512
|
-
*/
|
|
1513
|
-
function baseIsNative(value) {
|
|
1514
|
-
if (!isObject(value) || isMasked(value)) {
|
|
1515
|
-
return false;
|
|
1516
|
-
}
|
|
1517
|
-
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
|
1518
|
-
return pattern.test(toSource(value));
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
/**
|
|
1522
|
-
* The base implementation of `_.set`.
|
|
1523
|
-
*
|
|
1524
|
-
* @private
|
|
1525
|
-
* @param {Object} object The object to modify.
|
|
1526
|
-
* @param {Array|string} path The path of the property to set.
|
|
1527
|
-
* @param {*} value The value to set.
|
|
1528
|
-
* @param {Function} [customizer] The function to customize path creation.
|
|
1529
|
-
* @returns {Object} Returns `object`.
|
|
1530
|
-
*/
|
|
1531
|
-
function baseSet(object, path, value, customizer) {
|
|
1532
|
-
if (!isObject(object)) {
|
|
1533
|
-
return object;
|
|
1534
|
-
}
|
|
1535
|
-
path = isKey(path, object) ? [path] : castPath(path);
|
|
1536
|
-
|
|
1537
|
-
var index = -1,
|
|
1538
|
-
length = path.length,
|
|
1539
|
-
lastIndex = length - 1,
|
|
1540
|
-
nested = object;
|
|
1541
|
-
|
|
1542
|
-
while (nested != null && ++index < length) {
|
|
1543
|
-
var key = toKey(path[index]),
|
|
1544
|
-
newValue = value;
|
|
1545
|
-
|
|
1546
|
-
if (index != lastIndex) {
|
|
1547
|
-
var objValue = nested[key];
|
|
1548
|
-
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
|
1549
|
-
if (newValue === undefined) {
|
|
1550
|
-
newValue = isObject(objValue)
|
|
1551
|
-
? objValue
|
|
1552
|
-
: (isIndex(path[index + 1]) ? [] : {});
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
assignValue(nested, key, newValue);
|
|
1556
|
-
nested = nested[key];
|
|
1557
|
-
}
|
|
1558
|
-
return object;
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
/**
|
|
1562
|
-
* The base implementation of `_.toString` which doesn't convert nullish
|
|
1563
|
-
* values to empty strings.
|
|
1564
|
-
*
|
|
1565
|
-
* @private
|
|
1566
|
-
* @param {*} value The value to process.
|
|
1567
|
-
* @returns {string} Returns the string.
|
|
1568
|
-
*/
|
|
1569
|
-
function baseToString(value) {
|
|
1570
|
-
// Exit early for strings to avoid a performance hit in some environments.
|
|
1571
|
-
if (typeof value == 'string') {
|
|
1572
|
-
return value;
|
|
1573
|
-
}
|
|
1574
|
-
if (isSymbol(value)) {
|
|
1575
|
-
return symbolToString ? symbolToString.call(value) : '';
|
|
1576
|
-
}
|
|
1577
|
-
var result = (value + '');
|
|
1578
|
-
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
/**
|
|
1582
|
-
* Casts `value` to a path array if it's not one.
|
|
1583
|
-
*
|
|
1584
|
-
* @private
|
|
1585
|
-
* @param {*} value The value to inspect.
|
|
1586
|
-
* @returns {Array} Returns the cast property path array.
|
|
1587
|
-
*/
|
|
1588
|
-
function castPath(value) {
|
|
1589
|
-
return isArray(value) ? value : stringToPath(value);
|
|
1590
|
-
}
|
|
1591
|
-
|
|
1592
|
-
/**
|
|
1593
|
-
* Gets the data for `map`.
|
|
1594
|
-
*
|
|
1595
|
-
* @private
|
|
1596
|
-
* @param {Object} map The map to query.
|
|
1597
|
-
* @param {string} key The reference key.
|
|
1598
|
-
* @returns {*} Returns the map data.
|
|
1599
|
-
*/
|
|
1600
|
-
function getMapData(map, key) {
|
|
1601
|
-
var data = map.__data__;
|
|
1602
|
-
return isKeyable(key)
|
|
1603
|
-
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1604
|
-
: data.map;
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
/**
|
|
1608
|
-
* Gets the native function at `key` of `object`.
|
|
1609
|
-
*
|
|
1610
|
-
* @private
|
|
1611
|
-
* @param {Object} object The object to query.
|
|
1612
|
-
* @param {string} key The key of the method to get.
|
|
1613
|
-
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
1614
|
-
*/
|
|
1615
|
-
function getNative(object, key) {
|
|
1616
|
-
var value = getValue(object, key);
|
|
1617
|
-
return baseIsNative(value) ? value : undefined;
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
|
-
/**
|
|
1621
|
-
* Checks if `value` is a valid array-like index.
|
|
1622
|
-
*
|
|
1623
|
-
* @private
|
|
1624
|
-
* @param {*} value The value to check.
|
|
1625
|
-
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
1626
|
-
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
1627
|
-
*/
|
|
1628
|
-
function isIndex(value, length) {
|
|
1629
|
-
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
1630
|
-
return !!length &&
|
|
1631
|
-
(typeof value == 'number' || reIsUint.test(value)) &&
|
|
1632
|
-
(value > -1 && value % 1 == 0 && value < length);
|
|
1633
|
-
}
|
|
1634
|
-
|
|
1635
|
-
/**
|
|
1636
|
-
* Checks if `value` is a property name and not a property path.
|
|
1637
|
-
*
|
|
1638
|
-
* @private
|
|
1639
|
-
* @param {*} value The value to check.
|
|
1640
|
-
* @param {Object} [object] The object to query keys on.
|
|
1641
|
-
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
1642
|
-
*/
|
|
1643
|
-
function isKey(value, object) {
|
|
1644
|
-
if (isArray(value)) {
|
|
1645
|
-
return false;
|
|
1646
|
-
}
|
|
1647
|
-
var type = typeof value;
|
|
1648
|
-
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
1649
|
-
value == null || isSymbol(value)) {
|
|
1650
|
-
return true;
|
|
1651
|
-
}
|
|
1652
|
-
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
1653
|
-
(object != null && value in Object(object));
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
/**
|
|
1657
|
-
* Checks if `value` is suitable for use as unique object key.
|
|
1658
|
-
*
|
|
1659
|
-
* @private
|
|
1660
|
-
* @param {*} value The value to check.
|
|
1661
|
-
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1662
|
-
*/
|
|
1663
|
-
function isKeyable(value) {
|
|
1664
|
-
var type = typeof value;
|
|
1665
|
-
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
1666
|
-
? (value !== '__proto__')
|
|
1667
|
-
: (value === null);
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
/**
|
|
1671
|
-
* Checks if `func` has its source masked.
|
|
1672
|
-
*
|
|
1673
|
-
* @private
|
|
1674
|
-
* @param {Function} func The function to check.
|
|
1675
|
-
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
1676
|
-
*/
|
|
1677
|
-
function isMasked(func) {
|
|
1678
|
-
return !!maskSrcKey && (maskSrcKey in func);
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
|
-
/**
|
|
1682
|
-
* Converts `string` to a property path array.
|
|
1683
|
-
*
|
|
1684
|
-
* @private
|
|
1685
|
-
* @param {string} string The string to convert.
|
|
1686
|
-
* @returns {Array} Returns the property path array.
|
|
1687
|
-
*/
|
|
1688
|
-
var stringToPath = memoize(function(string) {
|
|
1689
|
-
string = toString(string);
|
|
1690
|
-
|
|
1691
|
-
var result = [];
|
|
1692
|
-
if (reLeadingDot.test(string)) {
|
|
1693
|
-
result.push('');
|
|
1694
|
-
}
|
|
1695
|
-
string.replace(rePropName, function(match, number, quote, string) {
|
|
1696
|
-
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
|
1697
|
-
});
|
|
1698
|
-
return result;
|
|
1699
|
-
});
|
|
1700
|
-
|
|
1701
|
-
/**
|
|
1702
|
-
* Converts `value` to a string key if it's not a string or symbol.
|
|
1703
|
-
*
|
|
1704
|
-
* @private
|
|
1705
|
-
* @param {*} value The value to inspect.
|
|
1706
|
-
* @returns {string|symbol} Returns the key.
|
|
1707
|
-
*/
|
|
1708
|
-
function toKey(value) {
|
|
1709
|
-
if (typeof value == 'string' || isSymbol(value)) {
|
|
1710
|
-
return value;
|
|
1711
|
-
}
|
|
1712
|
-
var result = (value + '');
|
|
1713
|
-
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
1714
|
-
}
|
|
1715
|
-
|
|
1716
|
-
/**
|
|
1717
|
-
* Converts `func` to its source code.
|
|
1718
|
-
*
|
|
1719
|
-
* @private
|
|
1720
|
-
* @param {Function} func The function to process.
|
|
1721
|
-
* @returns {string} Returns the source code.
|
|
1722
|
-
*/
|
|
1723
|
-
function toSource(func) {
|
|
1724
|
-
if (func != null) {
|
|
1725
|
-
try {
|
|
1726
|
-
return funcToString.call(func);
|
|
1727
|
-
} catch (e) {}
|
|
1728
|
-
try {
|
|
1729
|
-
return (func + '');
|
|
1730
|
-
} catch (e) {}
|
|
1731
|
-
}
|
|
1732
|
-
return '';
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
|
-
/**
|
|
1736
|
-
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
1737
|
-
* provided, it determines the cache key for storing the result based on the
|
|
1738
|
-
* arguments provided to the memoized function. By default, the first argument
|
|
1739
|
-
* provided to the memoized function is used as the map cache key. The `func`
|
|
1740
|
-
* is invoked with the `this` binding of the memoized function.
|
|
1741
|
-
*
|
|
1742
|
-
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
1743
|
-
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
1744
|
-
* constructor with one whose instances implement the
|
|
1745
|
-
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
1746
|
-
* method interface of `delete`, `get`, `has`, and `set`.
|
|
1747
|
-
*
|
|
1748
|
-
* @static
|
|
1749
|
-
* @memberOf _
|
|
1750
|
-
* @since 0.1.0
|
|
1751
|
-
* @category Function
|
|
1752
|
-
* @param {Function} func The function to have its output memoized.
|
|
1753
|
-
* @param {Function} [resolver] The function to resolve the cache key.
|
|
1754
|
-
* @returns {Function} Returns the new memoized function.
|
|
1755
|
-
* @example
|
|
1756
|
-
*
|
|
1757
|
-
* var object = { 'a': 1, 'b': 2 };
|
|
1758
|
-
* var other = { 'c': 3, 'd': 4 };
|
|
1759
|
-
*
|
|
1760
|
-
* var values = _.memoize(_.values);
|
|
1761
|
-
* values(object);
|
|
1762
|
-
* // => [1, 2]
|
|
1763
|
-
*
|
|
1764
|
-
* values(other);
|
|
1765
|
-
* // => [3, 4]
|
|
1766
|
-
*
|
|
1767
|
-
* object.a = 2;
|
|
1768
|
-
* values(object);
|
|
1769
|
-
* // => [1, 2]
|
|
1770
|
-
*
|
|
1771
|
-
* // Modify the result cache.
|
|
1772
|
-
* values.cache.set(object, ['a', 'b']);
|
|
1773
|
-
* values(object);
|
|
1774
|
-
* // => ['a', 'b']
|
|
1775
|
-
*
|
|
1776
|
-
* // Replace `_.memoize.Cache`.
|
|
1777
|
-
* _.memoize.Cache = WeakMap;
|
|
1778
|
-
*/
|
|
1779
|
-
function memoize(func, resolver) {
|
|
1780
|
-
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
|
|
1781
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
1782
|
-
}
|
|
1783
|
-
var memoized = function() {
|
|
1784
|
-
var args = arguments,
|
|
1785
|
-
key = resolver ? resolver.apply(this, args) : args[0],
|
|
1786
|
-
cache = memoized.cache;
|
|
1787
|
-
|
|
1788
|
-
if (cache.has(key)) {
|
|
1789
|
-
return cache.get(key);
|
|
1790
|
-
}
|
|
1791
|
-
var result = func.apply(this, args);
|
|
1792
|
-
memoized.cache = cache.set(key, result);
|
|
1793
|
-
return result;
|
|
1794
|
-
};
|
|
1795
|
-
memoized.cache = new (memoize.Cache || MapCache);
|
|
1796
|
-
return memoized;
|
|
1797
|
-
}
|
|
1798
|
-
|
|
1799
|
-
// Assign cache to `_.memoize`.
|
|
1800
|
-
memoize.Cache = MapCache;
|
|
1801
|
-
|
|
1802
|
-
/**
|
|
1803
|
-
* Performs a
|
|
1804
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
1805
|
-
* comparison between two values to determine if they are equivalent.
|
|
1806
|
-
*
|
|
1807
|
-
* @static
|
|
1808
|
-
* @memberOf _
|
|
1809
|
-
* @since 4.0.0
|
|
1810
|
-
* @category Lang
|
|
1811
|
-
* @param {*} value The value to compare.
|
|
1812
|
-
* @param {*} other The other value to compare.
|
|
1813
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
1814
|
-
* @example
|
|
1815
|
-
*
|
|
1816
|
-
* var object = { 'a': 1 };
|
|
1817
|
-
* var other = { 'a': 1 };
|
|
1818
|
-
*
|
|
1819
|
-
* _.eq(object, object);
|
|
1820
|
-
* // => true
|
|
1821
|
-
*
|
|
1822
|
-
* _.eq(object, other);
|
|
1823
|
-
* // => false
|
|
1824
|
-
*
|
|
1825
|
-
* _.eq('a', 'a');
|
|
1826
|
-
* // => true
|
|
1827
|
-
*
|
|
1828
|
-
* _.eq('a', Object('a'));
|
|
1829
|
-
* // => false
|
|
1830
|
-
*
|
|
1831
|
-
* _.eq(NaN, NaN);
|
|
1832
|
-
* // => true
|
|
1833
|
-
*/
|
|
1834
|
-
function eq(value, other) {
|
|
1835
|
-
return value === other || (value !== value && other !== other);
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
/**
|
|
1839
|
-
* Checks if `value` is classified as an `Array` object.
|
|
1840
|
-
*
|
|
1841
|
-
* @static
|
|
1842
|
-
* @memberOf _
|
|
1843
|
-
* @since 0.1.0
|
|
1844
|
-
* @category Lang
|
|
1845
|
-
* @param {*} value The value to check.
|
|
1846
|
-
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
1847
|
-
* @example
|
|
1848
|
-
*
|
|
1849
|
-
* _.isArray([1, 2, 3]);
|
|
1850
|
-
* // => true
|
|
1851
|
-
*
|
|
1852
|
-
* _.isArray(document.body.children);
|
|
1853
|
-
* // => false
|
|
1854
|
-
*
|
|
1855
|
-
* _.isArray('abc');
|
|
1856
|
-
* // => false
|
|
1857
|
-
*
|
|
1858
|
-
* _.isArray(_.noop);
|
|
1859
|
-
* // => false
|
|
1860
|
-
*/
|
|
1861
|
-
var isArray = Array.isArray;
|
|
1862
|
-
|
|
1863
|
-
/**
|
|
1864
|
-
* Checks if `value` is classified as a `Function` object.
|
|
1865
|
-
*
|
|
1866
|
-
* @static
|
|
1867
|
-
* @memberOf _
|
|
1868
|
-
* @since 0.1.0
|
|
1869
|
-
* @category Lang
|
|
1870
|
-
* @param {*} value The value to check.
|
|
1871
|
-
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
1872
|
-
* @example
|
|
1873
|
-
*
|
|
1874
|
-
* _.isFunction(_);
|
|
1875
|
-
* // => true
|
|
1876
|
-
*
|
|
1877
|
-
* _.isFunction(/abc/);
|
|
1878
|
-
* // => false
|
|
1879
|
-
*/
|
|
1880
|
-
function isFunction(value) {
|
|
1881
|
-
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
1882
|
-
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
|
1883
|
-
var tag = isObject(value) ? objectToString.call(value) : '';
|
|
1884
|
-
return tag == funcTag || tag == genTag;
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
/**
|
|
1888
|
-
* Checks if `value` is the
|
|
1889
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
1890
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
1891
|
-
*
|
|
1892
|
-
* @static
|
|
1893
|
-
* @memberOf _
|
|
1894
|
-
* @since 0.1.0
|
|
1895
|
-
* @category Lang
|
|
1896
|
-
* @param {*} value The value to check.
|
|
1897
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
1898
|
-
* @example
|
|
1899
|
-
*
|
|
1900
|
-
* _.isObject({});
|
|
1901
|
-
* // => true
|
|
1902
|
-
*
|
|
1903
|
-
* _.isObject([1, 2, 3]);
|
|
1904
|
-
* // => true
|
|
1905
|
-
*
|
|
1906
|
-
* _.isObject(_.noop);
|
|
1907
|
-
* // => true
|
|
1908
|
-
*
|
|
1909
|
-
* _.isObject(null);
|
|
1910
|
-
* // => false
|
|
1911
|
-
*/
|
|
1912
|
-
function isObject(value) {
|
|
1913
|
-
var type = typeof value;
|
|
1914
|
-
return !!value && (type == 'object' || type == 'function');
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
/**
|
|
1918
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
1919
|
-
* and has a `typeof` result of "object".
|
|
1920
|
-
*
|
|
1921
|
-
* @static
|
|
1922
|
-
* @memberOf _
|
|
1923
|
-
* @since 4.0.0
|
|
1924
|
-
* @category Lang
|
|
1925
|
-
* @param {*} value The value to check.
|
|
1926
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
1927
|
-
* @example
|
|
1928
|
-
*
|
|
1929
|
-
* _.isObjectLike({});
|
|
1930
|
-
* // => true
|
|
1931
|
-
*
|
|
1932
|
-
* _.isObjectLike([1, 2, 3]);
|
|
1933
|
-
* // => true
|
|
1934
|
-
*
|
|
1935
|
-
* _.isObjectLike(_.noop);
|
|
1936
|
-
* // => false
|
|
1937
|
-
*
|
|
1938
|
-
* _.isObjectLike(null);
|
|
1939
|
-
* // => false
|
|
1940
|
-
*/
|
|
1941
|
-
function isObjectLike(value) {
|
|
1942
|
-
return !!value && typeof value == 'object';
|
|
1943
|
-
}
|
|
1944
|
-
|
|
1945
|
-
/**
|
|
1946
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
1947
|
-
*
|
|
1948
|
-
* @static
|
|
1949
|
-
* @memberOf _
|
|
1950
|
-
* @since 4.0.0
|
|
1951
|
-
* @category Lang
|
|
1952
|
-
* @param {*} value The value to check.
|
|
1953
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
1954
|
-
* @example
|
|
1955
|
-
*
|
|
1956
|
-
* _.isSymbol(Symbol.iterator);
|
|
1957
|
-
* // => true
|
|
1958
|
-
*
|
|
1959
|
-
* _.isSymbol('abc');
|
|
1960
|
-
* // => false
|
|
1961
|
-
*/
|
|
1962
|
-
function isSymbol(value) {
|
|
1963
|
-
return typeof value == 'symbol' ||
|
|
1964
|
-
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1967
|
-
/**
|
|
1968
|
-
* Converts `value` to a string. An empty string is returned for `null`
|
|
1969
|
-
* and `undefined` values. The sign of `-0` is preserved.
|
|
1970
|
-
*
|
|
1971
|
-
* @static
|
|
1972
|
-
* @memberOf _
|
|
1973
|
-
* @since 4.0.0
|
|
1974
|
-
* @category Lang
|
|
1975
|
-
* @param {*} value The value to process.
|
|
1976
|
-
* @returns {string} Returns the string.
|
|
1977
|
-
* @example
|
|
1978
|
-
*
|
|
1979
|
-
* _.toString(null);
|
|
1980
|
-
* // => ''
|
|
1981
|
-
*
|
|
1982
|
-
* _.toString(-0);
|
|
1983
|
-
* // => '-0'
|
|
1984
|
-
*
|
|
1985
|
-
* _.toString([1, 2, 3]);
|
|
1986
|
-
* // => '1,2,3'
|
|
1987
|
-
*/
|
|
1988
|
-
function toString(value) {
|
|
1989
|
-
return value == null ? '' : baseToString(value);
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
|
-
/**
|
|
1993
|
-
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
|
|
1994
|
-
* it's created. Arrays are created for missing index properties while objects
|
|
1995
|
-
* are created for all other missing properties. Use `_.setWith` to customize
|
|
1996
|
-
* `path` creation.
|
|
1997
|
-
*
|
|
1998
|
-
* **Note:** This method mutates `object`.
|
|
1999
|
-
*
|
|
2000
|
-
* @static
|
|
2001
|
-
* @memberOf _
|
|
2002
|
-
* @since 3.7.0
|
|
2003
|
-
* @category Object
|
|
2004
|
-
* @param {Object} object The object to modify.
|
|
2005
|
-
* @param {Array|string} path The path of the property to set.
|
|
2006
|
-
* @param {*} value The value to set.
|
|
2007
|
-
* @returns {Object} Returns `object`.
|
|
2008
|
-
* @example
|
|
2009
|
-
*
|
|
2010
|
-
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
2011
|
-
*
|
|
2012
|
-
* _.set(object, 'a[0].b.c', 4);
|
|
2013
|
-
* console.log(object.a[0].b.c);
|
|
2014
|
-
* // => 4
|
|
2015
|
-
*
|
|
2016
|
-
* _.set(object, ['x', '0', 'y', 'z'], 5);
|
|
2017
|
-
* console.log(object.x[0].y.z);
|
|
2018
|
-
* // => 5
|
|
2019
|
-
*/
|
|
2020
|
-
function set(object, path, value) {
|
|
2021
|
-
return object == null ? object : baseSet(object, path, value);
|
|
2022
|
-
}
|
|
2023
|
-
|
|
2024
|
-
var lodash_set = set;
|
|
2025
|
-
|
|
2026
86
|
class QueryModel {
|
|
2027
87
|
queryKey;
|
|
2028
88
|
queryClient;
|
|
@@ -2040,7 +100,7 @@ class QueryModel {
|
|
|
2040
100
|
if (!path) {
|
|
2041
101
|
return Array.isArray(data) ? data : [data];
|
|
2042
102
|
}
|
|
2043
|
-
return
|
|
103
|
+
return result(data, path, []);
|
|
2044
104
|
}
|
|
2045
105
|
findMany(selector, path) {
|
|
2046
106
|
const data = this.findAll(path) ?? [];
|
|
@@ -2075,11 +135,11 @@ class QueryModel {
|
|
|
2075
135
|
}
|
|
2076
136
|
else {
|
|
2077
137
|
const queryData = this.queryClient.getQueryData(this.queryKey, { exact: this.exact }) ?? {};
|
|
2078
|
-
this.queryClient.setQueryData(this.queryKey,
|
|
138
|
+
this.queryClient.setQueryData(this.queryKey, set(queryData, path, newData));
|
|
2079
139
|
}
|
|
2080
140
|
return updatedRecord;
|
|
2081
141
|
}
|
|
2082
|
-
|
|
142
|
+
remove(id, path) {
|
|
2083
143
|
const oldData = this.findAll(path) ?? [];
|
|
2084
144
|
const modelConfig = this.getModelConfig();
|
|
2085
145
|
if (!modelConfig?.idColumn) {
|
|
@@ -2100,7 +160,7 @@ class QueryModel {
|
|
|
2100
160
|
}
|
|
2101
161
|
else {
|
|
2102
162
|
const queryData = this.queryClient.getQueryData(this.queryKey, { exact: this.exact }) ?? {};
|
|
2103
|
-
this.queryClient.setQueryData(this.queryKey,
|
|
163
|
+
this.queryClient.setQueryData(this.queryKey, set(queryData, path, newData));
|
|
2104
164
|
}
|
|
2105
165
|
return updated;
|
|
2106
166
|
}
|
|
@@ -2111,11 +171,104 @@ class QueryModel {
|
|
|
2111
171
|
}
|
|
2112
172
|
}
|
|
2113
173
|
|
|
2114
|
-
const
|
|
174
|
+
const useKeyTrackerModel = (keyTracker) => {
|
|
175
|
+
const queryClient = useQueryClient();
|
|
176
|
+
const getQueryKey = (innerKeyTracker) => {
|
|
177
|
+
const queryKey = queryClient.getQueryData([innerKeyTracker ?? keyTracker]);
|
|
178
|
+
return queryKey;
|
|
179
|
+
};
|
|
180
|
+
const refetchQuery = async (innerKeyTracker) => {
|
|
181
|
+
const queryKey = getQueryKey(innerKeyTracker ?? keyTracker);
|
|
182
|
+
await queryClient.refetchQueries({
|
|
183
|
+
queryKey,
|
|
184
|
+
exact: true,
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
return { refetchQuery, getQueryKey };
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const useQueryModel = (keyTracker, exact = true) => {
|
|
2115
191
|
const queryClient = useQueryClient();
|
|
2116
192
|
const { getQueryKey } = useKeyTrackerModel(keyTracker);
|
|
2117
193
|
const queryKey = getQueryKey();
|
|
2118
|
-
|
|
194
|
+
const findAll = (path) => {
|
|
195
|
+
const data = queryClient.getQueryData(queryKey, { exact });
|
|
196
|
+
if (!data) {
|
|
197
|
+
return [];
|
|
198
|
+
}
|
|
199
|
+
if (!path) {
|
|
200
|
+
return Array.isArray(data) ? data : [data];
|
|
201
|
+
}
|
|
202
|
+
return result(data, path, []);
|
|
203
|
+
};
|
|
204
|
+
const findMany = (selector, path) => {
|
|
205
|
+
const data = findAll(path) ?? [];
|
|
206
|
+
return data.filter(selector);
|
|
207
|
+
};
|
|
208
|
+
const find = (id, path) => {
|
|
209
|
+
const modelConfig = getModelConfig();
|
|
210
|
+
if (!modelConfig?.idColumn) {
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
const data = findAll(path) ?? [];
|
|
214
|
+
return data.find((record) => record[modelConfig.idColumn] === id);
|
|
215
|
+
};
|
|
216
|
+
const getModelConfig = () => {
|
|
217
|
+
const { options } = queryClient.getQueryData(['config']) ?? {};
|
|
218
|
+
const { modelConfig } = options ?? {};
|
|
219
|
+
return modelConfig;
|
|
220
|
+
};
|
|
221
|
+
const update = (id, data, path) => {
|
|
222
|
+
const oldData = findAll(path) ?? [];
|
|
223
|
+
const modelConfig = getModelConfig();
|
|
224
|
+
if (!modelConfig?.idColumn) {
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
const idColumn = modelConfig.idColumn;
|
|
228
|
+
let updatedRecord = undefined;
|
|
229
|
+
const newData = oldData.map((record) => {
|
|
230
|
+
let dataRecord = record;
|
|
231
|
+
if (dataRecord[idColumn] === id) {
|
|
232
|
+
dataRecord = { ...dataRecord, ...data };
|
|
233
|
+
updatedRecord = dataRecord;
|
|
234
|
+
}
|
|
235
|
+
return dataRecord;
|
|
236
|
+
});
|
|
237
|
+
if (!path) {
|
|
238
|
+
queryClient.setQueryData(queryKey, newData);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
const queryData = queryClient.getQueryData(queryKey, { exact }) ?? {};
|
|
242
|
+
queryClient.setQueryData(queryKey, set(queryData, path, newData));
|
|
243
|
+
}
|
|
244
|
+
return updatedRecord;
|
|
245
|
+
};
|
|
246
|
+
const remove = (id, path) => {
|
|
247
|
+
const oldData = findAll(path) ?? [];
|
|
248
|
+
const modelConfig = getModelConfig();
|
|
249
|
+
if (!modelConfig?.idColumn) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
const idColumn = modelConfig.idColumn;
|
|
253
|
+
let updated = false;
|
|
254
|
+
const newData = oldData.filter((record) => {
|
|
255
|
+
const dataRecord = record;
|
|
256
|
+
if (dataRecord[idColumn] === id) {
|
|
257
|
+
updated = true;
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
return true;
|
|
261
|
+
});
|
|
262
|
+
if (!path) {
|
|
263
|
+
queryClient.setQueryData(queryKey, newData);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
const queryData = queryClient.getQueryData(queryKey, { exact }) ?? {};
|
|
267
|
+
queryClient.setQueryData(queryKey, set(queryData, path, newData));
|
|
268
|
+
}
|
|
269
|
+
return updated;
|
|
270
|
+
};
|
|
271
|
+
return { find, findAll, findMany, remove, update };
|
|
2119
272
|
};
|
|
2120
273
|
|
|
2121
274
|
const useRefetchQuery = async (queryKey) => {
|
|
@@ -2515,5 +668,5 @@ const usePostRequest = ({ path, isFormData = false, baseUrl, headers, fileSelect
|
|
|
2515
668
|
return { post, ...mutation };
|
|
2516
669
|
};
|
|
2517
670
|
|
|
2518
|
-
export { ContentType, HttpMethod, axiosInstance, bootstrapQueryRequest, buildFormData, errorTransformer, getDateInFuture, makeRequest, scrollToTop, successTransformer, useDeleteRequest, useEnvironmentVariables, useGetRequest, useKeyTrackerModel, usePatchRequest, usePostRequest, useQueryConfig, useQueryHeaders, useQueryModel, useReactNativeEnv, useRefetchQuery };
|
|
671
|
+
export { ContentType, HttpMethod, QueryModel, axiosInstance, bootstrapQueryRequest, buildFormData, errorTransformer, getDateInFuture, makeRequest, scrollToTop, successTransformer, useDeleteRequest, useEnvironmentVariables, useGetRequest, useKeyTrackerModel, usePatchRequest, usePostRequest, useQueryConfig, useQueryHeaders, useQueryModel, useReactNativeEnv, useRefetchQuery };
|
|
2519
672
|
//# sourceMappingURL=index.mjs.map
|