UNPKG

48.2 kBTypeScriptView Raw
1import _ = require("../index");
2// tslint:disable-next-line:strict-export-declare-modifiers
3type GlobalFunction = Function;
4declare module "../index" {
5 type FunctionBase = GlobalFunction;
6 interface LoDashStatic {
7 /**
8 * Casts value as an array if it’s not one.
9 *
10 * @param value The value to inspect.
11 * @return Returns the cast array.
12 */
13 castArray<T>(value?: Many<T>): T[];
14 }
15 interface Collection<T> {
16 /**
17 * @see _.castArray
18 */
19 castArray(): Collection<T>;
20 }
21 interface String {
22 /**
23 * @see _.castArray
24 */
25 castArray(): Collection<string>;
26 }
27 interface Object<T> {
28 /**
29 * @see _.castArray
30 */
31 castArray(): Collection<T>;
32 }
33 interface Function<T extends (...args: any) => any> {
34 /**
35 * @see _.castArray
36 */
37 castArray(): Collection<T>;
38 }
39 interface Primitive<T> {
40 /**
41 * @see _.castArray
42 */
43 castArray(): Collection<T>;
44 }
45 interface CollectionChain<T> {
46 /**
47 * @see _.castArray
48 */
49 castArray(): CollectionChain<T>;
50 }
51 interface StringChain {
52 /**
53 * @see _.castArray
54 */
55 castArray(): CollectionChain<string>;
56 }
57 interface StringNullableChain {
58 /**
59 * @see _.castArray
60 */
61 castArray(): CollectionChain<string | undefined>;
62 }
63 interface ObjectChain<T> {
64 /**
65 * @see _.castArray
66 */
67 castArray(): CollectionChain<T>;
68 }
69 interface FunctionChain<T extends (...args: any) => any> {
70 /**
71 * @see _.castArray
72 */
73 castArray(): CollectionChain<T>;
74 }
75 interface PrimitiveChain<T> {
76 /**
77 * @see _.castArray
78 */
79 castArray(): CollectionChain<T>;
80 }
81
82 interface LoDashStatic {
83 /**
84 * Creates a shallow clone of value.
85 *
86 * Note: This method is loosely based on the structured clone algorithm and supports cloning arrays,
87 * array buffers, booleans, date objects, maps, numbers, Object objects, regexes, sets, strings, symbols,
88 * and typed arrays. The own enumerable properties of arguments objects are cloned as plain objects. An empty
89 * object is returned for uncloneable values such as error objects, functions, DOM nodes, and WeakMaps.
90 *
91 * @param value The value to clone.
92 * @return Returns the cloned value.
93 */
94 clone<T>(value: T): T;
95 }
96
97 interface LoDashImplicitWrapper<TValue> {
98 /**
99 * @see _.clone
100 */
101 clone(): TValue;
102 /**
103 * @see _.cloneDeep
104 */
105 cloneDeep(): TValue;
106 /**
107 * @see _.cloneDeepWith
108 */
109 cloneDeepWith(customizer: CloneDeepWithCustomizer<TValue>): any;
110 /**
111 * @see _.cloneDeepWith
112 */
113 cloneDeepWith(): TValue;
114 /**
115 * @see _.cloneWith
116 */
117 cloneWith<TResult extends object | string | number | boolean | null>(customizer: CloneWithCustomizer<TValue, TResult>): TResult;
118 /**
119 * @see _.cloneWith
120 */
121 cloneWith<TResult>(customizer: CloneWithCustomizer<TValue, TResult | undefined>): TResult | TValue;
122 /**
123 * @see _.cloneWith
124 */
125 cloneWith(): TValue;
126 }
127 interface LoDashExplicitWrapper<TValue> {
128 /**
129 * @see _.clone
130 */
131 clone(): this;
132 /**
133 * @see _.cloneDeep
134 */
135 cloneDeep(): this;
136 /**
137 * @see _.cloneDeepWith
138 */
139 cloneDeepWith(customizer: CloneDeepWithCustomizer<TValue>): LoDashExplicitWrapper<any>;
140 /**
141 * @see _.cloneDeepWith
142 */
143 cloneDeepWith(): this;
144 /**
145 * @see _.cloneWith
146 */
147 cloneWith<TResult extends object | string | number | boolean | null>(customizer: CloneWithCustomizer<TValue, TResult>): ExpChain<TResult>;
148 /**
149 * @see _.cloneWith
150 */
151 cloneWith<TResult>(customizer: CloneWithCustomizer<TValue, TResult | undefined>): ExpChain<TResult | TValue>;
152 /**
153 * @see _.cloneWith
154 */
155 cloneWith(): this;
156 }
157
158 interface LoDashStatic {
159 /**
160 * This method is like _.clone except that it recursively clones value.
161 *
162 * @param value The value to recursively clone.
163 * @return Returns the deep cloned value.
164 */
165 cloneDeep<T>(value: T): T;
166 }
167 type CloneDeepWithCustomizer<TObject> = (value: any, key: number | string | undefined, object: TObject | undefined, stack: any) => any;
168 interface LoDashStatic {
169 /**
170 * This method is like _.cloneWith except that it recursively clones value.
171 *
172 * @param value The value to recursively clone.
173 * @param customizer The function to customize cloning.
174 * @return Returns the deep cloned value.
175 */
176 cloneDeepWith<T>(value: T, customizer: CloneDeepWithCustomizer<T>): any;
177 /**
178 * @see _.cloneDeepWith
179 */
180 cloneDeepWith<T>(value: T): T;
181 }
182 type CloneWithCustomizer<TValue, TResult> = (value: TValue, key: number | string | undefined, object: any, stack: any) => TResult;
183 interface LoDashStatic {
184 /**
185 * This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value.
186 * If customizer returns undefined cloning is handled by the method instead.
187 *
188 * @param value The value to clone.
189 * @param customizer The function to customize cloning.
190 * @return Returns the cloned value.
191 */
192 cloneWith<T, TResult extends object | string | number | boolean | null>(value: T, customizer: CloneWithCustomizer<T, TResult>): TResult;
193 /**
194 * @see _.cloneWith
195 */
196 cloneWith<T, TResult>(value: T, customizer: CloneWithCustomizer<T, TResult | undefined>): TResult | T;
197 /**
198 * @see _.cloneWith
199 */
200 cloneWith<T>(value: T): T;
201 }
202 interface LoDashStatic {
203 /**
204 * Checks if object conforms to source by invoking the predicate properties of source with the
205 * corresponding property values of object.
206 *
207 * Note: This method is equivalent to _.conforms when source is partially applied.
208 */
209 conformsTo<T>(object: T, source: ConformsPredicateObject<T>): boolean;
210 }
211 interface LoDashImplicitWrapper<TValue> {
212 /**
213 * @see _.conformsTo
214 */
215 conformsTo(source: ConformsPredicateObject<TValue>): boolean;
216 }
217 interface LoDashExplicitWrapper<TValue> {
218 /**
219 * @see _.conformsTo
220 */
221 conformsTo(source: ConformsPredicateObject<TValue>): PrimitiveChain<boolean>;
222 }
223 type CondPairNullary<R> = [() => boolean, () => R];
224 type CondPairUnary<T, R> = [(val: T) => boolean, (val: T) => R];
225 interface LoDashStatic {
226 /**
227 * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
228 * comparison between two values to determine if they are equivalent.
229 *
230 * @category Lang
231 * @param value The value to compare.
232 * @param other The other value to compare.
233 * @returns Returns `true` if the values are equivalent, else `false`.
234 * @example
235 *
236 * var object = { 'user': 'fred' };
237 * var other = { 'user': 'fred' };
238 *
239 * _.eq(object, object);
240 * // => true
241 *
242 * _.eq(object, other);
243 * // => false
244 *
245 * _.eq('a', 'a');
246 * // => true
247 *
248 * _.eq('a', Object('a'));
249 * // => false
250 *
251 * _.eq(NaN, NaN);
252 * // => true
253 */
254 eq(value: any, other: any): boolean;
255 }
256 interface LoDashImplicitWrapper<TValue> {
257 /**
258 * @see _.eq
259 */
260 eq(other: any): boolean;
261 }
262 interface LoDashExplicitWrapper<TValue> {
263 /**
264 * @see _.eq
265 */
266 eq(other: any): PrimitiveChain<boolean>;
267 }
268
269 interface LoDashStatic {
270 /**
271 * Checks if value is greater than other.
272 *
273 * @param value The value to compare.
274 * @param other The other value to compare.
275 * @return Returns true if value is greater than other, else false.
276 */
277 gt(value: any, other: any): boolean;
278 }
279 interface LoDashImplicitWrapper<TValue> {
280 /**
281 * @see _.gt
282 */
283 gt(other: any): boolean;
284 }
285 interface LoDashExplicitWrapper<TValue> {
286 /**
287 * @see _.gt
288 */
289 gt(other: any): PrimitiveChain<boolean>;
290 }
291
292 interface LoDashStatic {
293 /**
294 * Checks if value is greater than or equal to other.
295 *
296 * @param value The value to compare.
297 * @param other The other value to compare.
298 * @return Returns true if value is greater than or equal to other, else false.
299 */
300 gte(value: any, other: any): boolean;
301 }
302 interface LoDashImplicitWrapper<TValue> {
303 /**
304 * @see _.gte
305 */
306 gte(other: any): boolean;
307 }
308 interface LoDashExplicitWrapper<TValue> {
309 /**
310 * @see _.gte
311 */
312 gte(other: any): PrimitiveChain<boolean>;
313 }
314
315 interface LoDashStatic {
316 /**
317 * Checks if value is classified as an arguments object.
318 *
319 * @param value The value to check.
320 * @return Returns true if value is correctly classified, else false.
321 */
322 isArguments(value?: any): value is IArguments;
323 }
324 interface LoDashImplicitWrapper<TValue> {
325 /**
326 * @see _.isArguments
327 */
328 isArguments(): boolean;
329 }
330 interface LoDashExplicitWrapper<TValue> {
331 /**
332 * @see _.isArguments
333 */
334 isArguments(): PrimitiveChain<boolean>;
335 }
336
337 interface LoDashStatic {
338 /**
339 * Checks if value is classified as an Array object.
340 * @param value The value to check.
341 *
342 * @return Returns true if value is correctly classified, else false.
343 */
344 isArray(value?: any): value is any[];
345 /**
346 * @see _.isArray
347 */
348 isArray<T>(value?: any): value is any[];
349 }
350 interface LoDashImplicitWrapper<TValue> {
351 /**
352 * @see _.isArray
353 */
354 isArray(): boolean;
355 }
356 interface LoDashExplicitWrapper<TValue> {
357 /**
358 * @see _.isArray
359 */
360 isArray(): PrimitiveChain<boolean>;
361 }
362
363 interface LoDashStatic {
364 /**
365 * Checks if value is classified as an ArrayBuffer object.
366 *
367 * @param value The value to check.
368 * @return Returns true if value is correctly classified, else false.
369 */
370 isArrayBuffer(value?: any): value is ArrayBuffer;
371 }
372 interface LoDashImplicitWrapper<TValue> {
373 /**
374 * @see _.isArrayBuffer
375 */
376 isArrayBuffer(): boolean;
377 }
378 interface LoDashExplicitWrapper<TValue> {
379 /**
380 * @see _.isArrayBuffer
381 */
382 isArrayBuffer(): PrimitiveChain<boolean>;
383 }
384
385 interface LoDashStatic {
386 /**
387 * Checks if `value` is array-like. A value is considered array-like if it's
388 * not a function and has a `value.length` that's an integer greater than or
389 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
390 *
391 * @category Lang
392 * @param value The value to check.
393 * @returns Returns `true` if `value` is array-like, else `false`.
394 * @example
395 *
396 * _.isArrayLike([1, 2, 3]);
397 * // => true
398 *
399 * _.isArrayLike(document.body.children);
400 * // => true
401 *
402 * _.isArrayLike('abc');
403 * // => true
404 *
405 * _.isArrayLike(_.noop);
406 * // => false
407 */
408 isArrayLike<T extends { __lodashAnyHack: any }>(t: T): boolean;
409 /**
410 * @see _.isArrayLike
411 */
412 isArrayLike(value: ((...args: any[]) => any) | null | undefined): value is never;
413 /**
414 * @see _.isArrayLike
415 */
416 isArrayLike(value: any): value is { length: number };
417 }
418 interface LoDashImplicitWrapper<TValue> {
419 /**
420 * @see _.isArrayLike
421 */
422 isArrayLike(): boolean;
423 }
424 interface LoDashExplicitWrapper<TValue> {
425 /**
426 * @see _.isArrayLike
427 */
428 isArrayLike(): PrimitiveChain<boolean>;
429 }
430
431 interface LoDashStatic {
432 /**
433 * This method is like `_.isArrayLike` except that it also checks if `value`
434 * is an object.
435 *
436 * @category Lang
437 * @param value The value to check.
438 * @returns Returns `true` if `value` is an array-like object, else `false`.
439 * @example
440 *
441 * _.isArrayLikeObject([1, 2, 3]);
442 * // => true
443 *
444 * _.isArrayLikeObject(document.body.children);
445 * // => true
446 *
447 * _.isArrayLikeObject('abc');
448 * // => false
449 *
450 * _.isArrayLikeObject(_.noop);
451 * // => false
452 */
453 isArrayLikeObject<T extends { __lodashAnyHack: any }>(value: T): boolean;
454 /**
455 * @see _.isArrayLikeObject
456 */
457 isArrayLikeObject(value: ((...args: any[]) => any) | FunctionBase | string | boolean | number | null | undefined): value is never;
458 /**
459 * @see _.isArrayLikeObject
460 */
461 isArrayLikeObject(value: any): value is object & { length: number };
462 }
463 interface LoDashImplicitWrapper<TValue> {
464 /**
465 * @see _.isArrayLikeObject
466 */
467 isArrayLikeObject(): boolean;
468 }
469 interface LoDashExplicitWrapper<TValue> {
470 /**
471 * @see _.isArrayLikeObject
472 */
473 isArrayLikeObject(): PrimitiveChain<boolean>;
474 }
475
476 interface LoDashStatic {
477 /**
478 * Checks if value is classified as a boolean primitive or object.
479 *
480 * @param value The value to check.
481 * @return Returns true if value is correctly classified, else false.
482 */
483 isBoolean(value?: any): value is boolean;
484 }
485 interface LoDashImplicitWrapper<TValue> {
486 /**
487 * @see _.isBoolean
488 */
489 isBoolean(): boolean;
490 }
491 interface LoDashExplicitWrapper<TValue> {
492 /**
493 * @see _.isBoolean
494 */
495 isBoolean(): PrimitiveChain<boolean>;
496 }
497
498 interface LoDashStatic {
499 /**
500 * Checks if value is a buffer.
501 *
502 * @param value The value to check.
503 * @return Returns true if value is a buffer, else false.
504 */
505 isBuffer(value?: any): boolean;
506 }
507 interface LoDashImplicitWrapper<TValue> {
508 /**
509 * @see _.isBuffer
510 */
511 isBuffer(): boolean;
512 }
513 interface LoDashExplicitWrapper<TValue> {
514 /**
515 * @see _.isBuffer
516 */
517 isBuffer(): PrimitiveChain<boolean>;
518 }
519
520 interface LoDashStatic {
521 /**
522 * Checks if value is classified as a Date object.
523 * @param value The value to check.
524 *
525 * @return Returns true if value is correctly classified, else false.
526 */
527 isDate(value?: any): value is Date;
528 }
529 interface LoDashImplicitWrapper<TValue> {
530 /**
531 * @see _.isDate
532 */
533 isDate(): boolean;
534 }
535 interface LoDashExplicitWrapper<TValue> {
536 /**
537 * @see _.isDate
538 */
539 isDate(): PrimitiveChain<boolean>;
540 }
541
542 interface LoDashStatic {
543 /**
544 * Checks if value is a DOM element.
545 *
546 * @param value The value to check.
547 * @return Returns true if value is a DOM element, else false.
548 */
549 isElement(value?: any): boolean;
550 }
551 interface LoDashImplicitWrapper<TValue> {
552 /**
553 * @see _.isElement
554 */
555 isElement(): boolean;
556 }
557 interface LoDashExplicitWrapper<TValue> {
558 /**
559 * @see _.isElement
560 */
561 isElement(): PrimitiveChain<boolean>;
562 }
563
564 interface LoDashStatic {
565 /**
566 * Checks if value is empty. A value is considered empty unless its an arguments object, array, string, or
567 * jQuery-like collection with a length greater than 0 or an object with own enumerable properties.
568 *
569 * @param value The value to inspect.
570 * @return Returns true if value is empty, else false.
571 */
572 isEmpty(value?: any): boolean;
573 }
574 interface LoDashImplicitWrapper<TValue> {
575 /**
576 * @see _.isEmpty
577 */
578 isEmpty(): boolean;
579 }
580 interface LoDashExplicitWrapper<TValue> {
581 /**
582 * @see _.isEmpty
583 */
584 isEmpty(): PrimitiveChain<boolean>;
585 }
586
587 interface LoDashStatic {
588 /**
589 * Performs a deep comparison between two values to determine if they are
590 * equivalent.
591 *
592 * **Note:** This method supports comparing arrays, array buffers, booleans,
593 * date objects, error objects, maps, numbers, `Object` objects, regexes,
594 * sets, strings, symbols, and typed arrays. `Object` objects are compared
595 * by their own, not inherited, enumerable properties. Functions and DOM
596 * nodes are **not** supported.
597 *
598 * @category Lang
599 * @param value The value to compare.
600 * @param other The other value to compare.
601 * @returns Returns `true` if the values are equivalent, else `false`.
602 * @example
603 *
604 * var object = { 'user': 'fred' };
605 * var other = { 'user': 'fred' };
606 *
607 * _.isEqual(object, other);
608 * // => true
609 *
610 * object === other;
611 * // => false
612 */
613 isEqual(value: any, other: any): boolean;
614 }
615 interface LoDashImplicitWrapper<TValue> {
616 /**
617 * @see _.isEqual
618 */
619 isEqual(other: any): boolean;
620 }
621 interface LoDashExplicitWrapper<TValue> {
622 /**
623 * @see _.isEqual
624 */
625 isEqual(other: any): PrimitiveChain<boolean>;
626 }
627
628 type IsEqualCustomizer = (value: any, other: any, indexOrKey: PropertyName | undefined, parent: any, otherParent: any, stack: any) => boolean | undefined;
629 interface LoDashStatic {
630 /**
631 * This method is like `_.isEqual` except that it accepts `customizer` which is
632 * invoked to compare values. If `customizer` returns `undefined` comparisons are
633 * handled by the method instead. The `customizer` is invoked with up to seven arguments:
634 * (objValue, othValue [, index|key, object, other, stack]).
635 *
636 * @category Lang
637 * @param value The value to compare.
638 * @param other The other value to compare.
639 * @param [customizer] The function to customize comparisons.
640 * @returns Returns `true` if the values are equivalent, else `false`.
641 * @example
642 *
643 * function isGreeting(value) {
644 * return /^h(?:i|ello)$/.test(value);
645 * }
646 *
647 * function customizer(objValue, othValue) {
648 * if (isGreeting(objValue) && isGreeting(othValue)) {
649 * return true;
650 * }
651 * }
652 *
653 * var array = ['hello', 'goodbye'];
654 * var other = ['hi', 'goodbye'];
655 *
656 * _.isEqualWith(array, other, customizer);
657 * // => true
658 */
659 isEqualWith(value: any, other: any, customizer?: IsEqualCustomizer): boolean;
660 }
661 interface LoDashImplicitWrapper<TValue> {
662 /**
663 * @see _.isEqualWith
664 */
665 isEqualWith(other: any, customizer?: IsEqualCustomizer): boolean;
666 }
667 interface LoDashExplicitWrapper<TValue> {
668 /**
669 * @see _.isEqualWith
670 */
671 isEqualWith(other: any, customizer?: IsEqualCustomizer): PrimitiveChain<boolean>;
672 }
673
674 interface LoDashStatic {
675 /**
676 * Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError
677 * object.
678 *
679 * @param value The value to check.
680 * @return Returns true if value is an error object, else false.
681 */
682 isError(value: any): value is Error;
683 }
684 interface LoDashImplicitWrapper<TValue> {
685 /**
686 * @see _.isError
687 */
688 isError(): boolean;
689 }
690 interface LoDashExplicitWrapper<TValue> {
691 /**
692 * @see _.isError
693 */
694 isError(): PrimitiveChain<boolean>;
695 }
696
697 interface LoDashStatic {
698 /**
699 * Checks if value is a finite primitive number.
700 *
701 * Note: This method is based on Number.isFinite.
702 *
703 * @param value The value to check.
704 * @return Returns true if value is a finite number, else false.
705 */
706 isFinite(value?: any): boolean;
707 }
708 interface LoDashImplicitWrapper<TValue> {
709 /**
710 * @see _.isFinite
711 */
712 isFinite(): boolean;
713 }
714 interface LoDashExplicitWrapper<TValue> {
715 /**
716 * @see _.isFinite
717 */
718 isFinite(): PrimitiveChain<boolean>;
719 }
720
721 interface LoDashStatic {
722 /**
723 * Checks if value is a callable function.
724 *
725 * @param value The value to check.
726 * @return Returns true if value is correctly classified, else false.
727 */
728 isFunction(value: any): value is (...args: any[]) => any;
729 }
730 interface LoDashImplicitWrapper<TValue> {
731 /**
732 * @see _.isFunction
733 */
734 isFunction(): boolean;
735 }
736 interface LoDashExplicitWrapper<TValue> {
737 /**
738 * @see _.isFunction
739 */
740 isFunction(): PrimitiveChain<boolean>;
741 }
742
743 interface LoDashStatic {
744 /**
745 * Checks if `value` is an integer.
746 *
747 * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger).
748 *
749 * @category Lang
750 * @param value The value to check.
751 * @returns Returns `true` if `value` is an integer, else `false`.
752 * @example
753 *
754 * _.isInteger(3);
755 * // => true
756 *
757 * _.isInteger(Number.MIN_VALUE);
758 * // => false
759 *
760 * _.isInteger(Infinity);
761 * // => false
762 *
763 * _.isInteger('3');
764 * // => false
765 */
766 isInteger(value?: any): boolean;
767 }
768 interface LoDashImplicitWrapper<TValue> {
769 /**
770 * @see _.isInteger
771 */
772 isInteger(): boolean;
773 }
774 interface LoDashExplicitWrapper<TValue> {
775 /**
776 * @see _.isInteger
777 */
778 isInteger(): PrimitiveChain<boolean>;
779 }
780
781 interface LoDashStatic {
782 /**
783 * Checks if `value` is a valid array-like length.
784 *
785 * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
786 *
787 * @category Lang
788 * @param value The value to check.
789 * @returns Returns `true` if `value` is a valid length, else `false`.
790 * @example
791 *
792 * _.isLength(3);
793 * // => true
794 *
795 * _.isLength(Number.MIN_VALUE);
796 * // => false
797 *
798 * _.isLength(Infinity);
799 * // => false
800 *
801 * _.isLength('3');
802 * // => false
803 */
804 isLength(value?: any): boolean;
805 }
806 interface LoDashImplicitWrapper<TValue> {
807 /**
808 * @see _.isLength
809 */
810 isLength(): boolean;
811 }
812 interface LoDashExplicitWrapper<TValue> {
813 /**
814 * @see _.isLength
815 */
816 isLength(): PrimitiveChain<boolean>;
817 }
818
819 interface LoDashStatic {
820 /**
821 * Checks if value is classified as a Map object.
822 *
823 * @param value The value to check.
824 * @returns Returns true if value is correctly classified, else false.
825 */
826 isMap(value?: any): value is Map<any, any>;
827 }
828 interface LoDashImplicitWrapper<TValue> {
829 /**
830 * @see _.isMap
831 */
832 isMap(): boolean;
833 }
834 interface LoDashExplicitWrapper<TValue> {
835 /**
836 * @see _.isMap
837 */
838 isMap(): PrimitiveChain<boolean>;
839 }
840
841 interface LoDashStatic {
842 /**
843 * Performs a deep comparison between `object` and `source` to determine if
844 * `object` contains equivalent property values.
845 *
846 * **Note:** This method supports comparing the same values as `_.isEqual`.
847 *
848 * @category Lang
849 * @param object The object to inspect.
850 * @param source The object of property values to match.
851 * @returns Returns `true` if `object` is a match, else `false`.
852 * @example
853 *
854 * var object = { 'user': 'fred', 'age': 40 };
855 *
856 * _.isMatch(object, { 'age': 40 });
857 * // => true
858 *
859 * _.isMatch(object, { 'age': 36 });
860 * // => false
861 */
862 isMatch(object: object, source: object): boolean;
863 }
864 interface LoDashImplicitWrapper<TValue> {
865 /**
866 * @see _.isMatch
867 */
868 isMatch(source: object): boolean;
869 }
870 interface LoDashExplicitWrapper<TValue> {
871 /**
872 * @see _.isMatch
873 */
874 isMatch(source: object): PrimitiveChain<boolean>;
875 }
876
877 type isMatchWithCustomizer = (value: any, other: any, indexOrKey: PropertyName, object: object, source: object) => boolean | undefined;
878 interface LoDashStatic {
879 /**
880 * This method is like `_.isMatch` except that it accepts `customizer` which
881 * is invoked to compare values. If `customizer` returns `undefined` comparisons
882 * are handled by the method instead. The `customizer` is invoked with three
883 * arguments: (objValue, srcValue, index|key, object, source).
884 *
885 * @category Lang
886 * @param object The object to inspect.
887 * @param source The object of property values to match.
888 * @param [customizer] The function to customize comparisons.
889 * @returns Returns `true` if `object` is a match, else `false`.
890 * @example
891 *
892 * function isGreeting(value) {
893 * return /^h(?:i|ello)$/.test(value);
894 * }
895 *
896 * function customizer(objValue, srcValue) {
897 * if (isGreeting(objValue) && isGreeting(srcValue)) {
898 * return true;
899 * }
900 * }
901 *
902 * var object = { 'greeting': 'hello' };
903 * var source = { 'greeting': 'hi' };
904 *
905 * _.isMatchWith(object, source, customizer);
906 * // => true
907 */
908 isMatchWith(object: object, source: object, customizer: isMatchWithCustomizer): boolean;
909 }
910 interface LoDashImplicitWrapper<TValue> {
911 /**
912 * @see _.isMatchWith
913 */
914 isMatchWith(source: object, customizer: isMatchWithCustomizer): boolean;
915 }
916 interface LoDashExplicitWrapper<TValue> {
917 /**
918 * @see _.isMatchWith
919 */
920 isMatchWith(source: object, customizer: isMatchWithCustomizer): PrimitiveChain<boolean>;
921 }
922
923 interface LoDashStatic {
924 /**
925 * Checks if value is NaN.
926 *
927 * Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values.
928 *
929 * @param value The value to check.
930 * @return Returns true if value is NaN, else false.
931 */
932 isNaN(value?: any): boolean;
933 }
934 interface LoDashImplicitWrapper<TValue> {
935 /**
936 * @see _.isNaN
937 */
938 isNaN(): boolean;
939 }
940 interface LoDashExplicitWrapper<TValue> {
941 /**
942 * @see _.isNaN
943 */
944 isNaN(): PrimitiveChain<boolean>;
945 }
946
947 interface LoDashStatic {
948 /**
949 * Checks if value is a native function.
950 * @param value The value to check.
951 *
952 * @return Returns true if value is a native function, else false.
953 */
954 isNative(value: any): value is (...args: any[]) => any;
955 }
956 interface LoDashImplicitWrapper<TValue> {
957 /**
958 * @see _.isNative
959 */
960 isNative(): boolean;
961 }
962 interface LoDashExplicitWrapper<TValue> {
963 /**
964 * @see _.isNative
965 */
966 isNative(): PrimitiveChain<boolean>;
967 }
968
969 interface LoDashStatic {
970 /**
971 * Checks if `value` is `null` or `undefined`.
972 *
973 * @category Lang
974 * @param value The value to check.
975 * @returns Returns `true` if `value` is nullish, else `false`.
976 * @example
977 *
978 * _.isNil(null);
979 * // => true
980 *
981 * _.isNil(void 0);
982 * // => true
983 *
984 * _.isNil(NaN);
985 * // => false
986 */
987 isNil(value: any): value is null | undefined;
988 }
989 interface LoDashImplicitWrapper<TValue> {
990 /**
991 * @see _.isNil
992 */
993 isNil(): boolean;
994 }
995 interface LoDashExplicitWrapper<TValue> {
996 /**
997 * @see _.isNil
998 */
999 isNil(): PrimitiveChain<boolean>;
1000 }
1001
1002 interface LoDashStatic {
1003 /**
1004 * Checks if value is null.
1005 *
1006 * @param value The value to check.
1007 * @return Returns true if value is null, else false.
1008 */
1009 isNull(value: any): value is null;
1010 }
1011 interface LoDashImplicitWrapper<TValue> {
1012 /**
1013 * @see _.isNull
1014 */
1015 isNull(): boolean;
1016 }
1017 interface LoDashExplicitWrapper<TValue> {
1018 /**
1019 * @see _.isNull
1020 */
1021 isNull(): PrimitiveChain<boolean>;
1022 }
1023
1024 interface LoDashStatic {
1025 /**
1026 * Checks if value is classified as a Number primitive or object.
1027 *
1028 * Note: To exclude Infinity, -Infinity, and NaN, which are classified as numbers, use the _.isFinite method.
1029 *
1030 * @param value The value to check.
1031 * @return Returns true if value is correctly classified, else false.
1032 */
1033 isNumber(value?: any): value is number;
1034 }
1035 interface LoDashImplicitWrapper<TValue> {
1036 /**
1037 * @see _.isNumber
1038 */
1039 isNumber(): boolean;
1040 }
1041 interface LoDashExplicitWrapper<TValue> {
1042 /**
1043 * @see _.isNumber
1044 */
1045 isNumber(): PrimitiveChain<boolean>;
1046 }
1047
1048 interface LoDashStatic {
1049 /**
1050 * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0),
1051 * and new String(''))
1052 *
1053 * @param value The value to check.
1054 * @return Returns true if value is an object, else false.
1055 */
1056 isObject(value?: any): value is object;
1057 }
1058 interface LoDashImplicitWrapper<TValue> {
1059 /**
1060 * @see _.isObject
1061 */
1062 isObject(): this is LoDashImplicitWrapper<object>;
1063 }
1064 interface LoDashExplicitWrapper<TValue> {
1065 /**
1066 * @see _.isObject
1067 */
1068 isObject(): PrimitiveChain<boolean>;
1069 }
1070
1071 interface LoDashStatic {
1072 /**
1073 * Checks if `value` is object-like. A value is object-like if it's not `null`
1074 * and has a `typeof` result of "object".
1075 *
1076 * @category Lang
1077 * @param value The value to check.
1078 * @returns Returns `true` if `value` is object-like, else `false`.
1079 * @example
1080 *
1081 * _.isObjectLike({});
1082 * // => true
1083 *
1084 * _.isObjectLike([1, 2, 3]);
1085 * // => true
1086 *
1087 * _.isObjectLike(_.noop);
1088 * // => false
1089 *
1090 * _.isObjectLike(null);
1091 * // => false
1092 */
1093 isObjectLike(value?: any): boolean;
1094 }
1095 interface LoDashImplicitWrapper<TValue> {
1096 /**
1097 * @see _.isObjectLike
1098 */
1099 isObjectLike(): boolean;
1100 }
1101 interface LoDashExplicitWrapper<TValue> {
1102 /**
1103 * @see _.isObjectLike
1104 */
1105 isObjectLike(): PrimitiveChain<boolean>;
1106 }
1107
1108 interface LoDashStatic {
1109 /**
1110 * Checks if value is a plain object, that is, an object created by the Object constructor or one with a
1111 * [[Prototype]] of null.
1112 *
1113 * Note: This method assumes objects created by the Object constructor have no inherited enumerable properties.
1114 *
1115 * @param value The value to check.
1116 * @return Returns true if value is a plain object, else false.
1117 */
1118 isPlainObject(value?: any): boolean;
1119 }
1120 interface LoDashImplicitWrapper<TValue> {
1121 /**
1122 * @see _.isPlainObject
1123 */
1124 isPlainObject(): boolean;
1125 }
1126 interface LoDashExplicitWrapper<TValue> {
1127 /**
1128 * @see _.isPlainObject
1129 */
1130 isPlainObject(): PrimitiveChain<boolean>;
1131 }
1132
1133 interface LoDashStatic {
1134 /**
1135 * Checks if value is classified as a RegExp object.
1136 * @param value The value to check.
1137 *
1138 * @return Returns true if value is correctly classified, else false.
1139 */
1140 isRegExp(value?: any): value is RegExp;
1141 }
1142 interface LoDashImplicitWrapper<TValue> {
1143 /**
1144 * @see _.isRegExp
1145 */
1146 isRegExp(): boolean;
1147 }
1148 interface LoDashExplicitWrapper<TValue> {
1149 /**
1150 * @see _.isRegExp
1151 */
1152 isRegExp(): PrimitiveChain<boolean>;
1153 }
1154
1155 interface LoDashStatic {
1156 /**
1157 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
1158 * double precision number which isn't the result of a rounded unsafe integer.
1159 *
1160 * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
1161 *
1162 * @category Lang
1163 * @param value The value to check.
1164 * @returns Returns `true` if `value` is a safe integer, else `false`.
1165 * @example
1166 *
1167 * _.isSafeInteger(3);
1168 * // => true
1169 *
1170 * _.isSafeInteger(Number.MIN_VALUE);
1171 * // => false
1172 *
1173 * _.isSafeInteger(Infinity);
1174 * // => false
1175 *
1176 * _.isSafeInteger('3');
1177 * // => false
1178 */
1179 isSafeInteger(value: any): boolean;
1180 }
1181 interface LoDashImplicitWrapper<TValue> {
1182 /**
1183 * @see _.isSafeInteger
1184 */
1185 isSafeInteger(): boolean;
1186 }
1187 interface LoDashExplicitWrapper<TValue> {
1188 /**
1189 * @see _.isSafeInteger
1190 */
1191 isSafeInteger(): PrimitiveChain<boolean>;
1192 }
1193
1194 interface LoDashStatic {
1195 /**
1196 * Checks if value is classified as a Set object.
1197 *
1198 * @param value The value to check.
1199 * @returns Returns true if value is correctly classified, else false.
1200 */
1201 isSet(value?: any): value is Set<any>;
1202 }
1203 interface LoDashImplicitWrapper<TValue> {
1204 /**
1205 * @see _.isSet
1206 */
1207 isSet(): boolean;
1208 }
1209 interface LoDashExplicitWrapper<TValue> {
1210 /**
1211 * @see _.isSet
1212 */
1213 isSet(): PrimitiveChain<boolean>;
1214 }
1215
1216 interface LoDashStatic {
1217 /**
1218 * Checks if value is classified as a String primitive or object.
1219 *
1220 * @param value The value to check.
1221 * @return Returns true if value is correctly classified, else false.
1222 */
1223 isString(value?: any): value is string;
1224 }
1225 interface LoDashImplicitWrapper<TValue> {
1226 /**
1227 * @see _.isString
1228 */
1229 isString(): boolean;
1230 }
1231 interface LoDashExplicitWrapper<TValue> {
1232 /**
1233 * @see _.isString
1234 */
1235 isString(): PrimitiveChain<boolean>;
1236 }
1237
1238 interface LoDashStatic {
1239 /**
1240 * Checks if `value` is classified as a `Symbol` primitive or object.
1241 *
1242 * @category Lang
1243 * @param value The value to check.
1244 * @returns Returns `true` if `value` is correctly classified, else `false`.
1245 * @example
1246 *
1247 * _.isSymbol(Symbol.iterator);
1248 * // => true
1249 *
1250 * _.isSymbol('abc');
1251 * // => false
1252 */
1253 isSymbol(value: any): value is symbol;
1254 }
1255 interface LoDashImplicitWrapper<TValue> {
1256 /**
1257 * @see _.isSymbol
1258 */
1259 isSymbol(): boolean;
1260 }
1261 interface LoDashExplicitWrapper<TValue> {
1262 /**
1263 * @see _.isSymbol
1264 */
1265 isSymbol(): PrimitiveChain<boolean>;
1266 }
1267
1268 interface LoDashStatic {
1269 /**
1270 * Checks if value is classified as a typed array.
1271 *
1272 * @param value The value to check.
1273 * @return Returns true if value is correctly classified, else false.
1274 */
1275 isTypedArray(value: any): boolean;
1276 }
1277 interface LoDashImplicitWrapper<TValue> {
1278 /**
1279 * @see _.isTypedArray
1280 */
1281 isTypedArray(): boolean;
1282 }
1283 interface LoDashExplicitWrapper<TValue> {
1284 /**
1285 * @see _.isTypedArray
1286 */
1287 isTypedArray(): PrimitiveChain<boolean>;
1288 }
1289
1290 interface LoDashStatic {
1291 /**
1292 * Checks if value is undefined.
1293 *
1294 * @param value The value to check.
1295 * @return Returns true if value is undefined, else false.
1296 */
1297 isUndefined(value: any): value is undefined;
1298 }
1299 interface LoDashImplicitWrapper<TValue> {
1300 /**
1301 * @see _.isUndefined
1302 */
1303 isUndefined(): boolean;
1304 }
1305 interface LoDashExplicitWrapper<TValue> {
1306 /**
1307 * @see _.isUndefined
1308 */
1309 isUndefined(): PrimitiveChain<boolean>;
1310 }
1311
1312 interface LoDashStatic {
1313 /**
1314 * Checks if value is classified as a WeakMap object.
1315 *
1316 * @param value The value to check.
1317 * @returns Returns true if value is correctly classified, else false.
1318 */
1319 isWeakMap(value?: any): value is WeakMap<object, any>;
1320 }
1321 interface LoDashImplicitWrapper<TValue> {
1322 /**
1323 * @see _.isWeakMap
1324 */
1325 isWeakMap(): boolean;
1326 }
1327 interface LoDashExplicitWrapper<TValue> {
1328 /**
1329 * @see _.isWeakMap
1330 */
1331 isWeakMap(): PrimitiveChain<boolean>;
1332 }
1333
1334 interface LoDashStatic {
1335 /**
1336 * Checks if value is classified as a WeakSet object.
1337 *
1338 * @param value The value to check.
1339 * @returns Returns true if value is correctly classified, else false.
1340 */
1341 isWeakSet(value?: any): value is WeakSet<object>;
1342 }
1343 interface LoDashImplicitWrapper<TValue> {
1344 /**
1345 * @see _.isWeakSet
1346 */
1347 isWeakSet(): boolean;
1348 }
1349 interface LoDashExplicitWrapper<TValue> {
1350 /**
1351 * @see _.isWeakSet
1352 */
1353 isWeakSet(): PrimitiveChain<boolean>;
1354 }
1355
1356 interface LoDashStatic {
1357 /**
1358 * Checks if value is less than other.
1359 *
1360 * @param value The value to compare.
1361 * @param other The other value to compare.
1362 * @return Returns true if value is less than other, else false.
1363 */
1364 lt(value: any, other: any): boolean;
1365 }
1366 interface LoDashImplicitWrapper<TValue> {
1367 /**
1368 * @see _.lt
1369 */
1370 lt(other: any): boolean;
1371 }
1372 interface LoDashExplicitWrapper<TValue> {
1373 /**
1374 * @see _.lt
1375 */
1376 lt(other: any): PrimitiveChain<boolean>;
1377 }
1378
1379 interface LoDashStatic {
1380 /**
1381 * Checks if value is less than or equal to other.
1382 *
1383 * @param value The value to compare.
1384 * @param other The other value to compare.
1385 * @return Returns true if value is less than or equal to other, else false.
1386 */
1387 lte(value: any, other: any): boolean;
1388 }
1389 interface LoDashImplicitWrapper<TValue> {
1390 /**
1391 * @see _.lte
1392 */
1393 lte(other: any): boolean;
1394 }
1395 interface LoDashExplicitWrapper<TValue> {
1396 /**
1397 * @see _.lte
1398 */
1399 lte(other: any): PrimitiveChain<boolean>;
1400 }
1401
1402 interface LoDashStatic {
1403 /**
1404 * Converts value to an array.
1405 *
1406 * @param value The value to convert.
1407 * @return Returns the converted array.
1408 */
1409 toArray<T>(value: Dictionary<T> | NumericDictionary<T> | null | undefined): T[];
1410 /**
1411 * @see _.toArray
1412 */
1413 toArray<T>(value: T): Array<T[keyof T]>;
1414 /**
1415 * @see _.toArray
1416 */
1417 toArray(): any[];
1418 }
1419 interface String {
1420 /**
1421 * @see _.toArray
1422 */
1423 toArray(): Collection<string>;
1424 }
1425 interface Collection<T> {
1426 /**
1427 * @see _.toArray
1428 */
1429 toArray(): Collection<T>;
1430 }
1431 interface Object<T> {
1432 /**
1433 * @see _.toArray
1434 */
1435 toArray(): Collection<T[keyof T]>;
1436 }
1437 interface StringChain {
1438 /**
1439 * @see _.toArray
1440 */
1441 toArray(): CollectionChain<string>;
1442 }
1443 interface StringNullableChain {
1444 /**
1445 * @see _.toArray
1446 */
1447 toArray(): CollectionChain<string>;
1448 }
1449 interface CollectionChain<T> {
1450 /**
1451 * @see _.toArray
1452 */
1453 toArray(): CollectionChain<T>;
1454 }
1455 interface ObjectChain<T> {
1456 /**
1457 * @see _.toArray
1458 */
1459 toArray(): CollectionChain<T[keyof T]>;
1460 }
1461
1462 interface LoDashStatic {
1463 /**
1464 * Converts `value` to a finite number.
1465 *
1466 * @since 4.12.0
1467 * @category Lang
1468 * @param value The value to convert.
1469 * @returns Returns the converted number.
1470 * @example
1471 *
1472 * _.toFinite(3.2);
1473 * // => 3.2
1474 *
1475 * _.toFinite(Number.MIN_VALUE);
1476 * // => 5e-324
1477 *
1478 * _.toFinite(Infinity);
1479 * // => 1.7976931348623157e+308
1480 *
1481 * _.toFinite('3.2');
1482 * // => 3.2
1483 */
1484 toFinite(value: any): number;
1485 }
1486 interface LoDashImplicitWrapper<TValue> {
1487 /**
1488 * @see _.toFinite
1489 */
1490 toFinite(): number;
1491 }
1492 interface LoDashExplicitWrapper<TValue> {
1493 /**
1494 * @see _.toFinite
1495 */
1496 toFinite(): PrimitiveChain<number>;
1497 }
1498
1499 interface LoDashStatic {
1500 /**
1501 * Converts `value` to an integer.
1502 *
1503 * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
1504 *
1505 * @category Lang
1506 * @param value The value to convert.
1507 * @returns Returns the converted integer.
1508 * @example
1509 *
1510 * _.toInteger(3);
1511 * // => 3
1512 *
1513 * _.toInteger(Number.MIN_VALUE);
1514 * // => 0
1515 *
1516 * _.toInteger(Infinity);
1517 * // => 1.7976931348623157e+308
1518 *
1519 * _.toInteger('3');
1520 * // => 3
1521 */
1522 toInteger(value: any): number;
1523 }
1524 interface LoDashImplicitWrapper<TValue> {
1525 /**
1526 * @see _.toInteger
1527 */
1528 toInteger(): number;
1529 }
1530 interface LoDashExplicitWrapper<TValue> {
1531 /**
1532 * @see _.toInteger
1533 */
1534 toInteger(): PrimitiveChain<number>;
1535 }
1536
1537 interface LoDashStatic {
1538 /**
1539 * Converts `value` to an integer suitable for use as the length of an
1540 * array-like object.
1541 *
1542 * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
1543 *
1544 * @category Lang
1545 * @param value The value to convert.
1546 * @return Returns the converted integer.
1547 * @example
1548 *
1549 * _.toLength(3);
1550 * // => 3
1551 *
1552 * _.toLength(Number.MIN_VALUE);
1553 * // => 0
1554 *
1555 * _.toLength(Infinity);
1556 * // => 4294967295
1557 *
1558 * _.toLength('3');
1559 * // => 3
1560 */
1561 toLength(value: any): number;
1562 }
1563 interface LoDashImplicitWrapper<TValue> {
1564 /**
1565 * @see _.toLength
1566 */
1567 toLength(): number;
1568 }
1569 interface LoDashExplicitWrapper<TValue> {
1570 /**
1571 * @see _.toLength
1572 */
1573 toLength(): PrimitiveChain<number>;
1574 }
1575
1576 interface LoDashStatic {
1577 /**
1578 * Converts `value` to a number.
1579 *
1580 * @category Lang
1581 * @param value The value to process.
1582 * @returns Returns the number.
1583 * @example
1584 *
1585 * _.toNumber(3);
1586 * // => 3
1587 *
1588 * _.toNumber(Number.MIN_VALUE);
1589 * // => 5e-324
1590 *
1591 * _.toNumber(Infinity);
1592 * // => Infinity
1593 *
1594 * _.toNumber('3');
1595 * // => 3
1596 */
1597 toNumber(value: any): number;
1598 }
1599 interface LoDashImplicitWrapper<TValue> {
1600 /**
1601 * @see _.toNumber
1602 */
1603 toNumber(): number;
1604 }
1605 interface LoDashExplicitWrapper<TValue> {
1606 /**
1607 * @see _.toNumber
1608 */
1609 toNumber(): PrimitiveChain<number>;
1610 }
1611
1612 interface LoDashStatic {
1613 /**
1614 * Converts value to a plain object flattening inherited enumerable properties of value to own properties
1615 * of the plain object.
1616 *
1617 * @param value The value to convert.
1618 * @return Returns the converted plain object.
1619 */
1620 toPlainObject(value?: any): any;
1621 }
1622 interface LoDashImplicitWrapper<TValue> {
1623 /**
1624 * @see _.toPlainObject
1625 */
1626 toPlainObject(): Object<any>;
1627 }
1628 interface LoDashExplicitWrapper<TValue> {
1629 /**
1630 * @see _.toPlainObject
1631 */
1632 toPlainObject(): ObjectChain<any>;
1633 }
1634
1635 interface LoDashStatic {
1636 /**
1637 * Converts `value` to a safe integer. A safe integer can be compared and
1638 * represented correctly.
1639 *
1640 * @category Lang
1641 * @param value The value to convert.
1642 * @returns Returns the converted integer.
1643 * @example
1644 *
1645 * _.toSafeInteger(3);
1646 * // => 3
1647 *
1648 * _.toSafeInteger(Number.MIN_VALUE);
1649 * // => 0
1650 *
1651 * _.toSafeInteger(Infinity);
1652 * // => 9007199254740991
1653 *
1654 * _.toSafeInteger('3');
1655 * // => 3
1656 */
1657 toSafeInteger(value: any): number;
1658 }
1659 interface LoDashImplicitWrapper<TValue> {
1660 /**
1661 * @see _.toSafeInteger
1662 */
1663 toSafeInteger(): number;
1664 }
1665 interface LoDashExplicitWrapper<TValue> {
1666 /**
1667 * @see _.toSafeInteger
1668 */
1669 toSafeInteger(): PrimitiveChain<number>;
1670 }
1671
1672 interface LoDashStatic {
1673 /**
1674 * Converts `value` to a string if it's not one. An empty string is returned
1675 * for `null` and `undefined` values. The sign of `-0` is preserved.
1676 *
1677 * @category Lang
1678 * @param value The value to process.
1679 * @returns Returns the string.
1680 * @example
1681 *
1682 * _.toString(null);
1683 * // => ''
1684 *
1685 * _.toString(-0);
1686 * // => '-0'
1687 *
1688 * _.toString([1, 2, 3]);
1689 * // => '1,2,3'
1690 */
1691 toString(value: any): string;
1692 }
1693}