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