@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.
Files changed (61) hide show
  1. package/dist/{src/index.js → index.js} +1 -0
  2. package/dist/{src/index.js.map → index.js.map} +1 -1
  3. package/dist/index.mjs +102 -1949
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/model/Model.d.ts +1 -1
  6. package/dist/{src/model → model}/Model.js +6 -6
  7. package/dist/model/index.d.ts +1 -0
  8. package/dist/model/model.interface.d.ts +1 -1
  9. package/dist/model/useQueryModel.d.ts +2 -2
  10. package/dist/model/useQueryModel.js +91 -0
  11. package/dist/model/useQueryModel.js.map +1 -0
  12. package/package.json +1 -1
  13. package/src/model/Model.ts +1 -1
  14. package/src/model/index.ts +1 -0
  15. package/src/model/model.interface.ts +1 -1
  16. package/src/model/useQueryModel.ts +101 -3
  17. package/dist/_virtual/_commonjsHelpers.js +0 -4
  18. package/dist/_virtual/_commonjsHelpers.js.map +0 -1
  19. package/dist/node_modules/lodash.result/index.js +0 -937
  20. package/dist/node_modules/lodash.result/index.js.map +0 -1
  21. package/dist/node_modules/lodash.set/index.js +0 -995
  22. package/dist/node_modules/lodash.set/index.js.map +0 -1
  23. package/dist/src/model/useQueryModel.js +0 -13
  24. package/dist/src/model/useQueryModel.js.map +0 -1
  25. /package/dist/{src/config → config}/bootstrapQueryRequest.js +0 -0
  26. /package/dist/{src/config → config}/bootstrapQueryRequest.js.map +0 -0
  27. /package/dist/{src/config → config}/useEnvironmentVariables.js +0 -0
  28. /package/dist/{src/config → config}/useEnvironmentVariables.js.map +0 -0
  29. /package/dist/{src/config → config}/useQueryConfig.js +0 -0
  30. /package/dist/{src/config → config}/useQueryConfig.js.map +0 -0
  31. /package/dist/{src/config → config}/useQueryHeaders.js +0 -0
  32. /package/dist/{src/config → config}/useQueryHeaders.js.map +0 -0
  33. /package/dist/{src/config → config}/useReactNativeEnv.js +0 -0
  34. /package/dist/{src/config → config}/useReactNativeEnv.js.map +0 -0
  35. /package/dist/{src/helpers → helpers}/scrollToTop.js +0 -0
  36. /package/dist/{src/helpers → helpers}/scrollToTop.js.map +0 -0
  37. /package/dist/{src/helpers → helpers}/timeFuncs.js +0 -0
  38. /package/dist/{src/helpers → helpers}/timeFuncs.js.map +0 -0
  39. /package/dist/{src/model → model}/Model.js.map +0 -0
  40. /package/dist/{src/model → model}/useKeyTrackerModel.js +0 -0
  41. /package/dist/{src/model → model}/useKeyTrackerModel.js.map +0 -0
  42. /package/dist/{src/model → model}/useRefetchQuery.js +0 -0
  43. /package/dist/{src/model → model}/useRefetchQuery.js.map +0 -0
  44. /package/dist/{src/queries → queries}/useDeleteRequest.js +0 -0
  45. /package/dist/{src/queries → queries}/useDeleteRequest.js.map +0 -0
  46. /package/dist/{src/queries → queries}/useGetRequest.js +0 -0
  47. /package/dist/{src/queries → queries}/useGetRequest.js.map +0 -0
  48. /package/dist/{src/queries → queries}/usePatchRequest.js +0 -0
  49. /package/dist/{src/queries → queries}/usePatchRequest.js.map +0 -0
  50. /package/dist/{src/queries → queries}/usePostRequest.js +0 -0
  51. /package/dist/{src/queries → queries}/usePostRequest.js.map +0 -0
  52. /package/dist/{src/request → request}/axios-instance.js +0 -0
  53. /package/dist/{src/request → request}/axios-instance.js.map +0 -0
  54. /package/dist/{src/request → request}/buildFormData.js +0 -0
  55. /package/dist/{src/request → request}/buildFormData.js.map +0 -0
  56. /package/dist/{src/request → request}/make-request.js +0 -0
  57. /package/dist/{src/request → request}/make-request.js.map +0 -0
  58. /package/dist/{src/request → request}/request.enum.js +0 -0
  59. /package/dist/{src/request → request}/request.enum.js.map +0 -0
  60. /package/dist/{src/request → request}/transformer.js +0 -0
  61. /package/dist/{src/request → request}/transformer.js.map +0 -0
@@ -1,937 +0,0 @@
1
- import { commonjsGlobal } from '../../_virtual/_commonjsHelpers.js';
2
-
3
- /**
4
- * lodash (Custom Build) <https://lodash.com/>
5
- * Build: `lodash modularize exports="npm" -o ./`
6
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
7
- * Released under MIT license <https://lodash.com/license>
8
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
9
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
10
- */
11
-
12
- /** Used as the `TypeError` message for "Functions" methods. */
13
- var FUNC_ERROR_TEXT = 'Expected a function';
14
-
15
- /** Used to stand-in for `undefined` hash values. */
16
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
17
-
18
- /** Used as references for various `Number` constants. */
19
- var INFINITY = 1 / 0;
20
-
21
- /** `Object#toString` result references. */
22
- var funcTag = '[object Function]',
23
- genTag = '[object GeneratorFunction]',
24
- symbolTag = '[object Symbol]';
25
-
26
- /** Used to match property names within property paths. */
27
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
28
- reIsPlainProp = /^\w*$/,
29
- reLeadingDot = /^\./,
30
- rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
31
-
32
- /**
33
- * Used to match `RegExp`
34
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
35
- */
36
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
37
-
38
- /** Used to match backslashes in property paths. */
39
- var reEscapeChar = /\\(\\)?/g;
40
-
41
- /** Used to detect host constructors (Safari). */
42
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
43
-
44
- /** Detect free variable `global` from Node.js. */
45
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
46
-
47
- /** Detect free variable `self`. */
48
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
49
-
50
- /** Used as a reference to the global object. */
51
- var root = freeGlobal || freeSelf || Function('return this')();
52
-
53
- /**
54
- * Gets the value at `key` of `object`.
55
- *
56
- * @private
57
- * @param {Object} [object] The object to query.
58
- * @param {string} key The key of the property to get.
59
- * @returns {*} Returns the property value.
60
- */
61
- function getValue(object, key) {
62
- return object == null ? undefined : object[key];
63
- }
64
-
65
- /**
66
- * Checks if `value` is a host object in IE < 9.
67
- *
68
- * @private
69
- * @param {*} value The value to check.
70
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
71
- */
72
- function isHostObject(value) {
73
- // Many host objects are `Object` objects that can coerce to strings
74
- // despite having improperly defined `toString` methods.
75
- var result = false;
76
- if (value != null && typeof value.toString != 'function') {
77
- try {
78
- result = !!(value + '');
79
- } catch (e) {}
80
- }
81
- return result;
82
- }
83
-
84
- /** Used for built-in method references. */
85
- var arrayProto = Array.prototype,
86
- funcProto = Function.prototype,
87
- objectProto = Object.prototype;
88
-
89
- /** Used to detect overreaching core-js shims. */
90
- var coreJsData = root['__core-js_shared__'];
91
-
92
- /** Used to detect methods masquerading as native. */
93
- var maskSrcKey = (function() {
94
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
95
- return uid ? ('Symbol(src)_1.' + uid) : '';
96
- }());
97
-
98
- /** Used to resolve the decompiled source of functions. */
99
- var funcToString = funcProto.toString;
100
-
101
- /** Used to check objects for own properties. */
102
- var hasOwnProperty = objectProto.hasOwnProperty;
103
-
104
- /**
105
- * Used to resolve the
106
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
107
- * of values.
108
- */
109
- var objectToString = objectProto.toString;
110
-
111
- /** Used to detect if a method is native. */
112
- var reIsNative = RegExp('^' +
113
- funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
114
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
115
- );
116
-
117
- /** Built-in value references. */
118
- var Symbol = root.Symbol,
119
- splice = arrayProto.splice;
120
-
121
- /* Built-in method references that are verified to be native. */
122
- var Map = getNative(root, 'Map'),
123
- nativeCreate = getNative(Object, 'create');
124
-
125
- /** Used to convert symbols to primitives and strings. */
126
- var symbolProto = Symbol ? Symbol.prototype : undefined,
127
- symbolToString = symbolProto ? symbolProto.toString : undefined;
128
-
129
- /**
130
- * Creates a hash object.
131
- *
132
- * @private
133
- * @constructor
134
- * @param {Array} [entries] The key-value pairs to cache.
135
- */
136
- function Hash(entries) {
137
- var index = -1,
138
- length = entries ? entries.length : 0;
139
-
140
- this.clear();
141
- while (++index < length) {
142
- var entry = entries[index];
143
- this.set(entry[0], entry[1]);
144
- }
145
- }
146
-
147
- /**
148
- * Removes all key-value entries from the hash.
149
- *
150
- * @private
151
- * @name clear
152
- * @memberOf Hash
153
- */
154
- function hashClear() {
155
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
156
- }
157
-
158
- /**
159
- * Removes `key` and its value from the hash.
160
- *
161
- * @private
162
- * @name delete
163
- * @memberOf Hash
164
- * @param {Object} hash The hash to modify.
165
- * @param {string} key The key of the value to remove.
166
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
167
- */
168
- function hashDelete(key) {
169
- return this.has(key) && delete this.__data__[key];
170
- }
171
-
172
- /**
173
- * Gets the hash value for `key`.
174
- *
175
- * @private
176
- * @name get
177
- * @memberOf Hash
178
- * @param {string} key The key of the value to get.
179
- * @returns {*} Returns the entry value.
180
- */
181
- function hashGet(key) {
182
- var data = this.__data__;
183
- if (nativeCreate) {
184
- var result = data[key];
185
- return result === HASH_UNDEFINED ? undefined : result;
186
- }
187
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
188
- }
189
-
190
- /**
191
- * Checks if a hash value for `key` exists.
192
- *
193
- * @private
194
- * @name has
195
- * @memberOf Hash
196
- * @param {string} key The key of the entry to check.
197
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
198
- */
199
- function hashHas(key) {
200
- var data = this.__data__;
201
- return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
202
- }
203
-
204
- /**
205
- * Sets the hash `key` to `value`.
206
- *
207
- * @private
208
- * @name set
209
- * @memberOf Hash
210
- * @param {string} key The key of the value to set.
211
- * @param {*} value The value to set.
212
- * @returns {Object} Returns the hash instance.
213
- */
214
- function hashSet(key, value) {
215
- var data = this.__data__;
216
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
217
- return this;
218
- }
219
-
220
- // Add methods to `Hash`.
221
- Hash.prototype.clear = hashClear;
222
- Hash.prototype['delete'] = hashDelete;
223
- Hash.prototype.get = hashGet;
224
- Hash.prototype.has = hashHas;
225
- Hash.prototype.set = hashSet;
226
-
227
- /**
228
- * Creates an list cache object.
229
- *
230
- * @private
231
- * @constructor
232
- * @param {Array} [entries] The key-value pairs to cache.
233
- */
234
- function ListCache(entries) {
235
- var index = -1,
236
- length = entries ? entries.length : 0;
237
-
238
- this.clear();
239
- while (++index < length) {
240
- var entry = entries[index];
241
- this.set(entry[0], entry[1]);
242
- }
243
- }
244
-
245
- /**
246
- * Removes all key-value entries from the list cache.
247
- *
248
- * @private
249
- * @name clear
250
- * @memberOf ListCache
251
- */
252
- function listCacheClear() {
253
- this.__data__ = [];
254
- }
255
-
256
- /**
257
- * Removes `key` and its value from the list cache.
258
- *
259
- * @private
260
- * @name delete
261
- * @memberOf ListCache
262
- * @param {string} key The key of the value to remove.
263
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
264
- */
265
- function listCacheDelete(key) {
266
- var data = this.__data__,
267
- index = assocIndexOf(data, key);
268
-
269
- if (index < 0) {
270
- return false;
271
- }
272
- var lastIndex = data.length - 1;
273
- if (index == lastIndex) {
274
- data.pop();
275
- } else {
276
- splice.call(data, index, 1);
277
- }
278
- return true;
279
- }
280
-
281
- /**
282
- * Gets the list cache value for `key`.
283
- *
284
- * @private
285
- * @name get
286
- * @memberOf ListCache
287
- * @param {string} key The key of the value to get.
288
- * @returns {*} Returns the entry value.
289
- */
290
- function listCacheGet(key) {
291
- var data = this.__data__,
292
- index = assocIndexOf(data, key);
293
-
294
- return index < 0 ? undefined : data[index][1];
295
- }
296
-
297
- /**
298
- * Checks if a list cache value for `key` exists.
299
- *
300
- * @private
301
- * @name has
302
- * @memberOf ListCache
303
- * @param {string} key The key of the entry to check.
304
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
305
- */
306
- function listCacheHas(key) {
307
- return assocIndexOf(this.__data__, key) > -1;
308
- }
309
-
310
- /**
311
- * Sets the list cache `key` to `value`.
312
- *
313
- * @private
314
- * @name set
315
- * @memberOf ListCache
316
- * @param {string} key The key of the value to set.
317
- * @param {*} value The value to set.
318
- * @returns {Object} Returns the list cache instance.
319
- */
320
- function listCacheSet(key, value) {
321
- var data = this.__data__,
322
- index = assocIndexOf(data, key);
323
-
324
- if (index < 0) {
325
- data.push([key, value]);
326
- } else {
327
- data[index][1] = value;
328
- }
329
- return this;
330
- }
331
-
332
- // Add methods to `ListCache`.
333
- ListCache.prototype.clear = listCacheClear;
334
- ListCache.prototype['delete'] = listCacheDelete;
335
- ListCache.prototype.get = listCacheGet;
336
- ListCache.prototype.has = listCacheHas;
337
- ListCache.prototype.set = listCacheSet;
338
-
339
- /**
340
- * Creates a map cache object to store key-value pairs.
341
- *
342
- * @private
343
- * @constructor
344
- * @param {Array} [entries] The key-value pairs to cache.
345
- */
346
- function MapCache(entries) {
347
- var index = -1,
348
- length = entries ? entries.length : 0;
349
-
350
- this.clear();
351
- while (++index < length) {
352
- var entry = entries[index];
353
- this.set(entry[0], entry[1]);
354
- }
355
- }
356
-
357
- /**
358
- * Removes all key-value entries from the map.
359
- *
360
- * @private
361
- * @name clear
362
- * @memberOf MapCache
363
- */
364
- function mapCacheClear() {
365
- this.__data__ = {
366
- 'hash': new Hash,
367
- 'map': new (Map || ListCache),
368
- 'string': new Hash
369
- };
370
- }
371
-
372
- /**
373
- * Removes `key` and its value from the map.
374
- *
375
- * @private
376
- * @name delete
377
- * @memberOf MapCache
378
- * @param {string} key The key of the value to remove.
379
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
380
- */
381
- function mapCacheDelete(key) {
382
- return getMapData(this, key)['delete'](key);
383
- }
384
-
385
- /**
386
- * Gets the map value for `key`.
387
- *
388
- * @private
389
- * @name get
390
- * @memberOf MapCache
391
- * @param {string} key The key of the value to get.
392
- * @returns {*} Returns the entry value.
393
- */
394
- function mapCacheGet(key) {
395
- return getMapData(this, key).get(key);
396
- }
397
-
398
- /**
399
- * Checks if a map value for `key` exists.
400
- *
401
- * @private
402
- * @name has
403
- * @memberOf MapCache
404
- * @param {string} key The key of the entry to check.
405
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
406
- */
407
- function mapCacheHas(key) {
408
- return getMapData(this, key).has(key);
409
- }
410
-
411
- /**
412
- * Sets the map `key` to `value`.
413
- *
414
- * @private
415
- * @name set
416
- * @memberOf MapCache
417
- * @param {string} key The key of the value to set.
418
- * @param {*} value The value to set.
419
- * @returns {Object} Returns the map cache instance.
420
- */
421
- function mapCacheSet(key, value) {
422
- getMapData(this, key).set(key, value);
423
- return this;
424
- }
425
-
426
- // Add methods to `MapCache`.
427
- MapCache.prototype.clear = mapCacheClear;
428
- MapCache.prototype['delete'] = mapCacheDelete;
429
- MapCache.prototype.get = mapCacheGet;
430
- MapCache.prototype.has = mapCacheHas;
431
- MapCache.prototype.set = mapCacheSet;
432
-
433
- /**
434
- * Gets the index at which the `key` is found in `array` of key-value pairs.
435
- *
436
- * @private
437
- * @param {Array} array The array to inspect.
438
- * @param {*} key The key to search for.
439
- * @returns {number} Returns the index of the matched value, else `-1`.
440
- */
441
- function assocIndexOf(array, key) {
442
- var length = array.length;
443
- while (length--) {
444
- if (eq(array[length][0], key)) {
445
- return length;
446
- }
447
- }
448
- return -1;
449
- }
450
-
451
- /**
452
- * The base implementation of `_.isNative` without bad shim checks.
453
- *
454
- * @private
455
- * @param {*} value The value to check.
456
- * @returns {boolean} Returns `true` if `value` is a native function,
457
- * else `false`.
458
- */
459
- function baseIsNative(value) {
460
- if (!isObject(value) || isMasked(value)) {
461
- return false;
462
- }
463
- var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
464
- return pattern.test(toSource(value));
465
- }
466
-
467
- /**
468
- * The base implementation of `_.toString` which doesn't convert nullish
469
- * values to empty strings.
470
- *
471
- * @private
472
- * @param {*} value The value to process.
473
- * @returns {string} Returns the string.
474
- */
475
- function baseToString(value) {
476
- // Exit early for strings to avoid a performance hit in some environments.
477
- if (typeof value == 'string') {
478
- return value;
479
- }
480
- if (isSymbol(value)) {
481
- return symbolToString ? symbolToString.call(value) : '';
482
- }
483
- var result = (value + '');
484
- return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
485
- }
486
-
487
- /**
488
- * Casts `value` to a path array if it's not one.
489
- *
490
- * @private
491
- * @param {*} value The value to inspect.
492
- * @returns {Array} Returns the cast property path array.
493
- */
494
- function castPath(value) {
495
- return isArray(value) ? value : stringToPath(value);
496
- }
497
-
498
- /**
499
- * Gets the data for `map`.
500
- *
501
- * @private
502
- * @param {Object} map The map to query.
503
- * @param {string} key The reference key.
504
- * @returns {*} Returns the map data.
505
- */
506
- function getMapData(map, key) {
507
- var data = map.__data__;
508
- return isKeyable(key)
509
- ? data[typeof key == 'string' ? 'string' : 'hash']
510
- : data.map;
511
- }
512
-
513
- /**
514
- * Gets the native function at `key` of `object`.
515
- *
516
- * @private
517
- * @param {Object} object The object to query.
518
- * @param {string} key The key of the method to get.
519
- * @returns {*} Returns the function if it's native, else `undefined`.
520
- */
521
- function getNative(object, key) {
522
- var value = getValue(object, key);
523
- return baseIsNative(value) ? value : undefined;
524
- }
525
-
526
- /**
527
- * Checks if `value` is a property name and not a property path.
528
- *
529
- * @private
530
- * @param {*} value The value to check.
531
- * @param {Object} [object] The object to query keys on.
532
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
533
- */
534
- function isKey(value, object) {
535
- if (isArray(value)) {
536
- return false;
537
- }
538
- var type = typeof value;
539
- if (type == 'number' || type == 'symbol' || type == 'boolean' ||
540
- value == null || isSymbol(value)) {
541
- return true;
542
- }
543
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
544
- (object != null && value in Object(object));
545
- }
546
-
547
- /**
548
- * Checks if `value` is suitable for use as unique object key.
549
- *
550
- * @private
551
- * @param {*} value The value to check.
552
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
553
- */
554
- function isKeyable(value) {
555
- var type = typeof value;
556
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
557
- ? (value !== '__proto__')
558
- : (value === null);
559
- }
560
-
561
- /**
562
- * Checks if `func` has its source masked.
563
- *
564
- * @private
565
- * @param {Function} func The function to check.
566
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
567
- */
568
- function isMasked(func) {
569
- return !!maskSrcKey && (maskSrcKey in func);
570
- }
571
-
572
- /**
573
- * Converts `string` to a property path array.
574
- *
575
- * @private
576
- * @param {string} string The string to convert.
577
- * @returns {Array} Returns the property path array.
578
- */
579
- var stringToPath = memoize(function(string) {
580
- string = toString(string);
581
-
582
- var result = [];
583
- if (reLeadingDot.test(string)) {
584
- result.push('');
585
- }
586
- string.replace(rePropName, function(match, number, quote, string) {
587
- result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
588
- });
589
- return result;
590
- });
591
-
592
- /**
593
- * Converts `value` to a string key if it's not a string or symbol.
594
- *
595
- * @private
596
- * @param {*} value The value to inspect.
597
- * @returns {string|symbol} Returns the key.
598
- */
599
- function toKey(value) {
600
- if (typeof value == 'string' || isSymbol(value)) {
601
- return value;
602
- }
603
- var result = (value + '');
604
- return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
605
- }
606
-
607
- /**
608
- * Converts `func` to its source code.
609
- *
610
- * @private
611
- * @param {Function} func The function to process.
612
- * @returns {string} Returns the source code.
613
- */
614
- function toSource(func) {
615
- if (func != null) {
616
- try {
617
- return funcToString.call(func);
618
- } catch (e) {}
619
- try {
620
- return (func + '');
621
- } catch (e) {}
622
- }
623
- return '';
624
- }
625
-
626
- /**
627
- * Creates a function that memoizes the result of `func`. If `resolver` is
628
- * provided, it determines the cache key for storing the result based on the
629
- * arguments provided to the memoized function. By default, the first argument
630
- * provided to the memoized function is used as the map cache key. The `func`
631
- * is invoked with the `this` binding of the memoized function.
632
- *
633
- * **Note:** The cache is exposed as the `cache` property on the memoized
634
- * function. Its creation may be customized by replacing the `_.memoize.Cache`
635
- * constructor with one whose instances implement the
636
- * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
637
- * method interface of `delete`, `get`, `has`, and `set`.
638
- *
639
- * @static
640
- * @memberOf _
641
- * @since 0.1.0
642
- * @category Function
643
- * @param {Function} func The function to have its output memoized.
644
- * @param {Function} [resolver] The function to resolve the cache key.
645
- * @returns {Function} Returns the new memoized function.
646
- * @example
647
- *
648
- * var object = { 'a': 1, 'b': 2 };
649
- * var other = { 'c': 3, 'd': 4 };
650
- *
651
- * var values = _.memoize(_.values);
652
- * values(object);
653
- * // => [1, 2]
654
- *
655
- * values(other);
656
- * // => [3, 4]
657
- *
658
- * object.a = 2;
659
- * values(object);
660
- * // => [1, 2]
661
- *
662
- * // Modify the result cache.
663
- * values.cache.set(object, ['a', 'b']);
664
- * values(object);
665
- * // => ['a', 'b']
666
- *
667
- * // Replace `_.memoize.Cache`.
668
- * _.memoize.Cache = WeakMap;
669
- */
670
- function memoize(func, resolver) {
671
- if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
672
- throw new TypeError(FUNC_ERROR_TEXT);
673
- }
674
- var memoized = function() {
675
- var args = arguments,
676
- key = resolver ? resolver.apply(this, args) : args[0],
677
- cache = memoized.cache;
678
-
679
- if (cache.has(key)) {
680
- return cache.get(key);
681
- }
682
- var result = func.apply(this, args);
683
- memoized.cache = cache.set(key, result);
684
- return result;
685
- };
686
- memoized.cache = new (memoize.Cache || MapCache);
687
- return memoized;
688
- }
689
-
690
- // Assign cache to `_.memoize`.
691
- memoize.Cache = MapCache;
692
-
693
- /**
694
- * Performs a
695
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
696
- * comparison between two values to determine if they are equivalent.
697
- *
698
- * @static
699
- * @memberOf _
700
- * @since 4.0.0
701
- * @category Lang
702
- * @param {*} value The value to compare.
703
- * @param {*} other The other value to compare.
704
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
705
- * @example
706
- *
707
- * var object = { 'a': 1 };
708
- * var other = { 'a': 1 };
709
- *
710
- * _.eq(object, object);
711
- * // => true
712
- *
713
- * _.eq(object, other);
714
- * // => false
715
- *
716
- * _.eq('a', 'a');
717
- * // => true
718
- *
719
- * _.eq('a', Object('a'));
720
- * // => false
721
- *
722
- * _.eq(NaN, NaN);
723
- * // => true
724
- */
725
- function eq(value, other) {
726
- return value === other || (value !== value && other !== other);
727
- }
728
-
729
- /**
730
- * Checks if `value` is classified as an `Array` object.
731
- *
732
- * @static
733
- * @memberOf _
734
- * @since 0.1.0
735
- * @category Lang
736
- * @param {*} value The value to check.
737
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
738
- * @example
739
- *
740
- * _.isArray([1, 2, 3]);
741
- * // => true
742
- *
743
- * _.isArray(document.body.children);
744
- * // => false
745
- *
746
- * _.isArray('abc');
747
- * // => false
748
- *
749
- * _.isArray(_.noop);
750
- * // => false
751
- */
752
- var isArray = Array.isArray;
753
-
754
- /**
755
- * Checks if `value` is classified as a `Function` object.
756
- *
757
- * @static
758
- * @memberOf _
759
- * @since 0.1.0
760
- * @category Lang
761
- * @param {*} value The value to check.
762
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
763
- * @example
764
- *
765
- * _.isFunction(_);
766
- * // => true
767
- *
768
- * _.isFunction(/abc/);
769
- * // => false
770
- */
771
- function isFunction(value) {
772
- // The use of `Object#toString` avoids issues with the `typeof` operator
773
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
774
- var tag = isObject(value) ? objectToString.call(value) : '';
775
- return tag == funcTag || tag == genTag;
776
- }
777
-
778
- /**
779
- * Checks if `value` is the
780
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
781
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
782
- *
783
- * @static
784
- * @memberOf _
785
- * @since 0.1.0
786
- * @category Lang
787
- * @param {*} value The value to check.
788
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
789
- * @example
790
- *
791
- * _.isObject({});
792
- * // => true
793
- *
794
- * _.isObject([1, 2, 3]);
795
- * // => true
796
- *
797
- * _.isObject(_.noop);
798
- * // => true
799
- *
800
- * _.isObject(null);
801
- * // => false
802
- */
803
- function isObject(value) {
804
- var type = typeof value;
805
- return !!value && (type == 'object' || type == 'function');
806
- }
807
-
808
- /**
809
- * Checks if `value` is object-like. A value is object-like if it's not `null`
810
- * and has a `typeof` result of "object".
811
- *
812
- * @static
813
- * @memberOf _
814
- * @since 4.0.0
815
- * @category Lang
816
- * @param {*} value The value to check.
817
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
818
- * @example
819
- *
820
- * _.isObjectLike({});
821
- * // => true
822
- *
823
- * _.isObjectLike([1, 2, 3]);
824
- * // => true
825
- *
826
- * _.isObjectLike(_.noop);
827
- * // => false
828
- *
829
- * _.isObjectLike(null);
830
- * // => false
831
- */
832
- function isObjectLike(value) {
833
- return !!value && typeof value == 'object';
834
- }
835
-
836
- /**
837
- * Checks if `value` is classified as a `Symbol` primitive or object.
838
- *
839
- * @static
840
- * @memberOf _
841
- * @since 4.0.0
842
- * @category Lang
843
- * @param {*} value The value to check.
844
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
845
- * @example
846
- *
847
- * _.isSymbol(Symbol.iterator);
848
- * // => true
849
- *
850
- * _.isSymbol('abc');
851
- * // => false
852
- */
853
- function isSymbol(value) {
854
- return typeof value == 'symbol' ||
855
- (isObjectLike(value) && objectToString.call(value) == symbolTag);
856
- }
857
-
858
- /**
859
- * Converts `value` to a string. An empty string is returned for `null`
860
- * and `undefined` values. The sign of `-0` is preserved.
861
- *
862
- * @static
863
- * @memberOf _
864
- * @since 4.0.0
865
- * @category Lang
866
- * @param {*} value The value to process.
867
- * @returns {string} Returns the string.
868
- * @example
869
- *
870
- * _.toString(null);
871
- * // => ''
872
- *
873
- * _.toString(-0);
874
- * // => '-0'
875
- *
876
- * _.toString([1, 2, 3]);
877
- * // => '1,2,3'
878
- */
879
- function toString(value) {
880
- return value == null ? '' : baseToString(value);
881
- }
882
-
883
- /**
884
- * This method is like `_.get` except that if the resolved value is a
885
- * function it's invoked with the `this` binding of its parent object and
886
- * its result is returned.
887
- *
888
- * @static
889
- * @since 0.1.0
890
- * @memberOf _
891
- * @category Object
892
- * @param {Object} object The object to query.
893
- * @param {Array|string} path The path of the property to resolve.
894
- * @param {*} [defaultValue] The value returned for `undefined` resolved values.
895
- * @returns {*} Returns the resolved value.
896
- * @example
897
- *
898
- * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
899
- *
900
- * _.result(object, 'a[0].b.c1');
901
- * // => 3
902
- *
903
- * _.result(object, 'a[0].b.c2');
904
- * // => 4
905
- *
906
- * _.result(object, 'a[0].b.c3', 'default');
907
- * // => 'default'
908
- *
909
- * _.result(object, 'a[0].b.c3', _.constant('default'));
910
- * // => 'default'
911
- */
912
- function result(object, path, defaultValue) {
913
- path = isKey(path, object) ? [path] : castPath(path);
914
-
915
- var index = -1,
916
- length = path.length;
917
-
918
- // Ensure the loop is entered when path is empty.
919
- if (!length) {
920
- object = undefined;
921
- length = 1;
922
- }
923
- while (++index < length) {
924
- var value = object == null ? undefined : object[toKey(path[index])];
925
- if (value === undefined) {
926
- index = length;
927
- value = defaultValue;
928
- }
929
- object = isFunction(value) ? value.call(object) : value;
930
- }
931
- return object;
932
- }
933
-
934
- var lodash_result = result;
935
-
936
- export { lodash_result as default };
937
- //# sourceMappingURL=index.js.map