UNPKG

48.3 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 CondPair<T, R> = [(val: T) => boolean, (val: T) => R];
224 interface LoDashStatic {
225 /**
226 * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
227 * comparison between two values to determine if they are equivalent.
228 *
229 * @category Lang
230 * @param value The value to compare.
231 * @param other The other value to compare.
232 * @returns Returns `true` if the values are equivalent, else `false`.
233 * @example
234 *
235 * var object = { 'user': 'fred' };
236 * var other = { 'user': 'fred' };
237 *
238 * _.eq(object, object);
239 * // => true
240 *
241 * _.eq(object, other);
242 * // => false
243 *
244 * _.eq('a', 'a');
245 * // => true
246 *
247 * _.eq('a', Object('a'));
248 * // => false
249 *
250 * _.eq(NaN, NaN);
251 * // => true
252 */
253 eq(value: any, other: any): boolean;
254 }
255 interface LoDashImplicitWrapper<TValue> {
256 /**
257 * @see _.eq
258 */
259 eq(other: any): boolean;
260 }
261 interface LoDashExplicitWrapper<TValue> {
262 /**
263 * @see _.eq
264 */
265 eq(other: any): PrimitiveChain<boolean>;
266 }
267
268 interface LoDashStatic {
269 /**
270 * Checks if value is greater than other.
271 *
272 * @param value The value to compare.
273 * @param other The other value to compare.
274 * @return Returns true if value is greater than other, else false.
275 */
276 gt(value: any, other: any): boolean;
277 }
278 interface LoDashImplicitWrapper<TValue> {
279 /**
280 * @see _.gt
281 */
282 gt(other: any): boolean;
283 }
284 interface LoDashExplicitWrapper<TValue> {
285 /**
286 * @see _.gt
287 */
288 gt(other: any): PrimitiveChain<boolean>;
289 }
290
291 interface LoDashStatic {
292 /**
293 * Checks if value is greater than or equal to other.
294 *
295 * @param value The value to compare.
296 * @param other The other value to compare.
297 * @return Returns true if value is greater than or equal to other, else false.
298 */
299 gte(value: any, other: any): boolean;
300 }
301 interface LoDashImplicitWrapper<TValue> {
302 /**
303 * @see _.gte
304 */
305 gte(other: any): boolean;
306 }
307 interface LoDashExplicitWrapper<TValue> {
308 /**
309 * @see _.gte
310 */
311 gte(other: any): PrimitiveChain<boolean>;
312 }
313
314 interface LoDashStatic {
315 /**
316 * Checks if value is classified as an arguments object.
317 *
318 * @param value The value to check.
319 * @return Returns true if value is correctly classified, else false.
320 */
321 isArguments(value?: any): value is IArguments;
322 }
323 interface LoDashImplicitWrapper<TValue> {
324 /**
325 * @see _.isArguments
326 */
327 isArguments(): boolean;
328 }
329 interface LoDashExplicitWrapper<TValue> {
330 /**
331 * @see _.isArguments
332 */
333 isArguments(): PrimitiveChain<boolean>;
334 }
335
336 interface LoDashStatic {
337 /**
338 * Checks if value is classified as an Array object.
339 * @param value The value to check.
340 *
341 * @return Returns true if value is correctly classified, else false.
342 */
343 isArray(value?: any): value is any[];
344 /**
345 * @see _.isArray
346 */
347 isArray<T>(value?: any): value is any[];
348 }
349 interface LoDashImplicitWrapper<TValue> {
350 /**
351 * @see _.isArray
352 */
353 isArray(): boolean;
354 }
355 interface LoDashExplicitWrapper<TValue> {
356 /**
357 * @see _.isArray
358 */
359 isArray(): PrimitiveChain<boolean>;
360 }
361
362 interface LoDashStatic {
363 /**
364 * Checks if value is classified as an ArrayBuffer object.
365 *
366 * @param value The value to check.
367 * @return Returns true if value is correctly classified, else false.
368 */
369 isArrayBuffer(value?: any): value is ArrayBuffer;
370 }
371 interface LoDashImplicitWrapper<TValue> {
372 /**
373 * @see _.isArrayBuffer
374 */
375 isArrayBuffer(): boolean;
376 }
377 interface LoDashExplicitWrapper<TValue> {
378 /**
379 * @see _.isArrayBuffer
380 */
381 isArrayBuffer(): PrimitiveChain<boolean>;
382 }
383
384 interface LoDashStatic {
385 /**
386 * Checks if `value` is array-like. A value is considered array-like if it's
387 * not a function and has a `value.length` that's an integer greater than or
388 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
389 *
390 * @category Lang
391 * @param value The value to check.
392 * @returns Returns `true` if `value` is array-like, else `false`.
393 * @example
394 *
395 * _.isArrayLike([1, 2, 3]);
396 * // => true
397 *
398 * _.isArrayLike(document.body.children);
399 * // => true
400 *
401 * _.isArrayLike('abc');
402 * // => true
403 *
404 * _.isArrayLike(_.noop);
405 * // => false
406 */
407 isArrayLike<T extends { __lodashAnyHack: any }>(t: T): boolean;
408 /**
409 * @see _.isArrayLike
410 */
411 isArrayLike(value: ((...args: any[]) => any) | null | undefined): value is never;
412 /**
413 * @see _.isArrayLike
414 */
415 isArrayLike(value: any): value is { length: number };
416 }
417 interface LoDashImplicitWrapper<TValue> {
418 /**
419 * @see _.isArrayLike
420 */
421 isArrayLike(): boolean;
422 }
423 interface LoDashExplicitWrapper<TValue> {
424 /**
425 * @see _.isArrayLike
426 */
427 isArrayLike(): PrimitiveChain<boolean>;
428 }
429
430 interface LoDashStatic {
431 /**
432 * This method is like `_.isArrayLike` except that it also checks if `value`
433 * is an object.
434 *
435 * @category Lang
436 * @param value The value to check.
437 * @returns Returns `true` if `value` is an array-like object, else `false`.
438 * @example
439 *
440 * _.isArrayLikeObject([1, 2, 3]);
441 * // => true
442 *
443 * _.isArrayLikeObject(document.body.children);
444 * // => true
445 *
446 * _.isArrayLikeObject('abc');
447 * // => false
448 *
449 * _.isArrayLikeObject(_.noop);
450 * // => false
451 */
452 isArrayLikeObject<T extends { __lodashAnyHack: any }>(value: T): boolean;
453 // tslint:disable-next-line:ban-types (type guard doesn't seem to work correctly without the Function type)
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 type isMatchCustomizer = (value: any, other: any, indexOrKey?: PropertyName) => boolean;
842 interface LoDashStatic {
843 /**
844 * Performs a deep comparison between `object` and `source` to determine if
845 * `object` contains equivalent property values.
846 *
847 * **Note:** This method supports comparing the same values as `_.isEqual`.
848 *
849 * @category Lang
850 * @param object The object to inspect.
851 * @param source The object of property values to match.
852 * @returns Returns `true` if `object` is a match, else `false`.
853 * @example
854 *
855 * var object = { 'user': 'fred', 'age': 40 };
856 *
857 * _.isMatch(object, { 'age': 40 });
858 * // => true
859 *
860 * _.isMatch(object, { 'age': 36 });
861 * // => false
862 */
863 isMatch(object: object, source: object): boolean;
864 }
865 interface LoDashImplicitWrapper<TValue> {
866 /**
867 * @see _.isMatch
868 */
869 isMatch(source: object): boolean;
870 }
871 interface LoDashExplicitWrapper<TValue> {
872 /**
873 * @see _.isMatch
874 */
875 isMatch(source: object): PrimitiveChain<boolean>;
876 }
877
878 type isMatchWithCustomizer = (value: any, other: any, indexOrKey: PropertyName, object: object, source: object) => boolean;
879 interface LoDashStatic {
880 /**
881 * This method is like `_.isMatch` except that it accepts `customizer` which
882 * is invoked to compare values. If `customizer` returns `undefined` comparisons
883 * are handled by the method instead. The `customizer` is invoked with three
884 * arguments: (objValue, srcValue, index|key, object, source).
885 *
886 * @category Lang
887 * @param object The object to inspect.
888 * @param source The object of property values to match.
889 * @param [customizer] The function to customize comparisons.
890 * @returns Returns `true` if `object` is a match, else `false`.
891 * @example
892 *
893 * function isGreeting(value) {
894 * return /^h(?:i|ello)$/.test(value);
895 * }
896 *
897 * function customizer(objValue, srcValue) {
898 * if (isGreeting(objValue) && isGreeting(srcValue)) {
899 * return true;
900 * }
901 * }
902 *
903 * var object = { 'greeting': 'hello' };
904 * var source = { 'greeting': 'hi' };
905 *
906 * _.isMatchWith(object, source, customizer);
907 * // => true
908 */
909 isMatchWith(object: object, source: object, customizer: isMatchWithCustomizer): boolean;
910 }
911 interface LoDashImplicitWrapper<TValue> {
912 /**
913 * @see _.isMatchWith
914 */
915 isMatchWith(source: object, customizer: isMatchWithCustomizer): boolean;
916 }
917 interface LoDashExplicitWrapper<TValue> {
918 /**
919 * @see _.isMatchWith
920 */
921 isMatchWith(source: object, customizer: isMatchWithCustomizer): PrimitiveChain<boolean>;
922 }
923
924 interface LoDashStatic {
925 /**
926 * Checks if value is NaN.
927 *
928 * Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values.
929 *
930 * @param value The value to check.
931 * @return Returns true if value is NaN, else false.
932 */
933 isNaN(value?: any): boolean;
934 }
935 interface LoDashImplicitWrapper<TValue> {
936 /**
937 * @see _.isNaN
938 */
939 isNaN(): boolean;
940 }
941 interface LoDashExplicitWrapper<TValue> {
942 /**
943 * @see _.isNaN
944 */
945 isNaN(): PrimitiveChain<boolean>;
946 }
947
948 interface LoDashStatic {
949 /**
950 * Checks if value is a native function.
951 * @param value The value to check.
952 *
953 * @retrun Returns true if value is a native function, else false.
954 */
955 isNative(value: any): value is (...args: any[]) => any;
956 }
957 interface LoDashImplicitWrapper<TValue> {
958 /**
959 * @see _.isNative
960 */
961 isNative(): boolean;
962 }
963 interface LoDashExplicitWrapper<TValue> {
964 /**
965 * @see _.isNative
966 */
967 isNative(): PrimitiveChain<boolean>;
968 }
969
970 interface LoDashStatic {
971 /**
972 * Checks if `value` is `null` or `undefined`.
973 *
974 * @category Lang
975 * @param value The value to check.
976 * @returns Returns `true` if `value` is nullish, else `false`.
977 * @example
978 *
979 * _.isNil(null);
980 * // => true
981 *
982 * _.isNil(void 0);
983 * // => true
984 *
985 * _.isNil(NaN);
986 * // => false
987 */
988 isNil(value: any): value is null | undefined;
989 }
990 interface LoDashImplicitWrapper<TValue> {
991 /**
992 * @see _.isNil
993 */
994 isNil(): boolean;
995 }
996 interface LoDashExplicitWrapper<TValue> {
997 /**
998 * @see _.isNil
999 */
1000 isNil(): PrimitiveChain<boolean>;
1001 }
1002
1003 interface LoDashStatic {
1004 /**
1005 * Checks if value is null.
1006 *
1007 * @param value The value to check.
1008 * @return Returns true if value is null, else false.
1009 */
1010 isNull(value: any): value is null;
1011 }
1012 interface LoDashImplicitWrapper<TValue> {
1013 /**
1014 * @see _.isNull
1015 */
1016 isNull(): boolean;
1017 }
1018 interface LoDashExplicitWrapper<TValue> {
1019 /**
1020 * @see _.isNull
1021 */
1022 isNull(): PrimitiveChain<boolean>;
1023 }
1024
1025 interface LoDashStatic {
1026 /**
1027 * Checks if value is classified as a Number primitive or object.
1028 *
1029 * Note: To exclude Infinity, -Infinity, and NaN, which are classified as numbers, use the _.isFinite method.
1030 *
1031 * @param value The value to check.
1032 * @return Returns true if value is correctly classified, else false.
1033 */
1034 isNumber(value?: any): value is number;
1035 }
1036 interface LoDashImplicitWrapper<TValue> {
1037 /**
1038 * @see _.isNumber
1039 */
1040 isNumber(): boolean;
1041 }
1042 interface LoDashExplicitWrapper<TValue> {
1043 /**
1044 * @see _.isNumber
1045 */
1046 isNumber(): PrimitiveChain<boolean>;
1047 }
1048
1049 interface LoDashStatic {
1050 /**
1051 * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0),
1052 * and new String(''))
1053 *
1054 * @param value The value to check.
1055 * @return Returns true if value is an object, else false.
1056 */
1057 isObject(value?: any): value is object;
1058 }
1059 interface LoDashImplicitWrapper<TValue> {
1060 /**
1061 * @see _.isObject
1062 */
1063 isObject(): this is LoDashImplicitWrapper<object>;
1064 }
1065 interface LoDashExplicitWrapper<TValue> {
1066 /**
1067 * @see _.isObject
1068 */
1069 isObject(): PrimitiveChain<boolean>;
1070 }
1071
1072 interface LoDashStatic {
1073 /**
1074 * Checks if `value` is object-like. A value is object-like if it's not `null`
1075 * and has a `typeof` result of "object".
1076 *
1077 * @category Lang
1078 * @param value The value to check.
1079 * @returns Returns `true` if `value` is object-like, else `false`.
1080 * @example
1081 *
1082 * _.isObjectLike({});
1083 * // => true
1084 *
1085 * _.isObjectLike([1, 2, 3]);
1086 * // => true
1087 *
1088 * _.isObjectLike(_.noop);
1089 * // => false
1090 *
1091 * _.isObjectLike(null);
1092 * // => false
1093 */
1094 isObjectLike(value?: any): boolean;
1095 }
1096 interface LoDashImplicitWrapper<TValue> {
1097 /**
1098 * @see _.isObjectLike
1099 */
1100 isObjectLike(): boolean;
1101 }
1102 interface LoDashExplicitWrapper<TValue> {
1103 /**
1104 * @see _.isObjectLike
1105 */
1106 isObjectLike(): PrimitiveChain<boolean>;
1107 }
1108
1109 interface LoDashStatic {
1110 /**
1111 * Checks if value is a plain object, that is, an object created by the Object constructor or one with a
1112 * [[Prototype]] of null.
1113 *
1114 * Note: This method assumes objects created by the Object constructor have no inherited enumerable properties.
1115 *
1116 * @param value The value to check.
1117 * @return Returns true if value is a plain object, else false.
1118 */
1119 isPlainObject(value?: any): boolean;
1120 }
1121 interface LoDashImplicitWrapper<TValue> {
1122 /**
1123 * @see _.isPlainObject
1124 */
1125 isPlainObject(): boolean;
1126 }
1127 interface LoDashExplicitWrapper<TValue> {
1128 /**
1129 * @see _.isPlainObject
1130 */
1131 isPlainObject(): PrimitiveChain<boolean>;
1132 }
1133
1134 interface LoDashStatic {
1135 /**
1136 * Checks if value is classified as a RegExp object.
1137 * @param value The value to check.
1138 *
1139 * @return Returns true if value is correctly classified, else false.
1140 */
1141 isRegExp(value?: any): value is RegExp;
1142 }
1143 interface LoDashImplicitWrapper<TValue> {
1144 /**
1145 * @see _.isRegExp
1146 */
1147 isRegExp(): boolean;
1148 }
1149 interface LoDashExplicitWrapper<TValue> {
1150 /**
1151 * @see _.isRegExp
1152 */
1153 isRegExp(): PrimitiveChain<boolean>;
1154 }
1155
1156 interface LoDashStatic {
1157 /**
1158 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
1159 * double precision number which isn't the result of a rounded unsafe integer.
1160 *
1161 * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
1162 *
1163 * @category Lang
1164 * @param value The value to check.
1165 * @returns Returns `true` if `value` is a safe integer, else `false`.
1166 * @example
1167 *
1168 * _.isSafeInteger(3);
1169 * // => true
1170 *
1171 * _.isSafeInteger(Number.MIN_VALUE);
1172 * // => false
1173 *
1174 * _.isSafeInteger(Infinity);
1175 * // => false
1176 *
1177 * _.isSafeInteger('3');
1178 * // => false
1179 */
1180 isSafeInteger(value: any): boolean;
1181 }
1182 interface LoDashImplicitWrapper<TValue> {
1183 /**
1184 * @see _.isSafeInteger
1185 */
1186 isSafeInteger(): boolean;
1187 }
1188 interface LoDashExplicitWrapper<TValue> {
1189 /**
1190 * @see _.isSafeInteger
1191 */
1192 isSafeInteger(): PrimitiveChain<boolean>;
1193 }
1194
1195 interface LoDashStatic {
1196 /**
1197 * Checks if value is classified as a Set object.
1198 *
1199 * @param value The value to check.
1200 * @returns Returns true if value is correctly classified, else false.
1201 */
1202 isSet(value?: any): value is Set<any>;
1203 }
1204 interface LoDashImplicitWrapper<TValue> {
1205 /**
1206 * @see _.isSet
1207 */
1208 isSet(): boolean;
1209 }
1210 interface LoDashExplicitWrapper<TValue> {
1211 /**
1212 * @see _.isSet
1213 */
1214 isSet(): PrimitiveChain<boolean>;
1215 }
1216
1217 interface LoDashStatic {
1218 /**
1219 * Checks if value is classified as a String primitive or object.
1220 *
1221 * @param value The value to check.
1222 * @return Returns true if value is correctly classified, else false.
1223 */
1224 isString(value?: any): value is string;
1225 }
1226 interface LoDashImplicitWrapper<TValue> {
1227 /**
1228 * @see _.isString
1229 */
1230 isString(): boolean;
1231 }
1232 interface LoDashExplicitWrapper<TValue> {
1233 /**
1234 * @see _.isString
1235 */
1236 isString(): PrimitiveChain<boolean>;
1237 }
1238
1239 interface LoDashStatic {
1240 /**
1241 * Checks if `value` is classified as a `Symbol` primitive or object.
1242 *
1243 * @category Lang
1244 * @param value The value to check.
1245 * @returns Returns `true` if `value` is correctly classified, else `false`.
1246 * @example
1247 *
1248 * _.isSymbol(Symbol.iterator);
1249 * // => true
1250 *
1251 * _.isSymbol('abc');
1252 * // => false
1253 */
1254 isSymbol(value: any): boolean;
1255 }
1256 interface LoDashImplicitWrapper<TValue> {
1257 /**
1258 * @see _.isSymbol
1259 */
1260 isSymbol(): boolean;
1261 }
1262 interface LoDashExplicitWrapper<TValue> {
1263 /**
1264 * @see _.isSymbol
1265 */
1266 isSymbol(): PrimitiveChain<boolean>;
1267 }
1268
1269 interface LoDashStatic {
1270 /**
1271 * Checks if value is classified as a typed array.
1272 *
1273 * @param value The value to check.
1274 * @return Returns true if value is correctly classified, else false.
1275 */
1276 isTypedArray(value: any): boolean;
1277 }
1278 interface LoDashImplicitWrapper<TValue> {
1279 /**
1280 * @see _.isTypedArray
1281 */
1282 isTypedArray(): boolean;
1283 }
1284 interface LoDashExplicitWrapper<TValue> {
1285 /**
1286 * @see _.isTypedArray
1287 */
1288 isTypedArray(): PrimitiveChain<boolean>;
1289 }
1290
1291 interface LoDashStatic {
1292 /**
1293 * Checks if value is undefined.
1294 *
1295 * @param value The value to check.
1296 * @return Returns true if value is undefined, else false.
1297 */
1298 isUndefined(value: any): value is undefined;
1299 }
1300 interface LoDashImplicitWrapper<TValue> {
1301 /**
1302 * @see _.isUndefined
1303 */
1304 isUndefined(): boolean;
1305 }
1306 interface LoDashExplicitWrapper<TValue> {
1307 /**
1308 * @see _.isUndefined
1309 */
1310 isUndefined(): PrimitiveChain<boolean>;
1311 }
1312
1313 interface LoDashStatic {
1314 /**
1315 * Checks if value is classified as a WeakMap object.
1316 *
1317 * @param value The value to check.
1318 * @returns Returns true if value is correctly classified, else false.
1319 */
1320 isWeakMap(value?: any): value is WeakMap<object, any>;
1321 }
1322 interface LoDashImplicitWrapper<TValue> {
1323 /**
1324 * @see _.isWeakMap
1325 */
1326 isWeakMap(): boolean;
1327 }
1328 interface LoDashExplicitWrapper<TValue> {
1329 /**
1330 * @see _.isWeakMap
1331 */
1332 isWeakMap(): PrimitiveChain<boolean>;
1333 }
1334
1335 interface LoDashStatic {
1336 /**
1337 * Checks if value is classified as a WeakSet object.
1338 *
1339 * @param value The value to check.
1340 * @returns Returns true if value is correctly classified, else false.
1341 */
1342 isWeakSet(value?: any): value is WeakSet<object>;
1343 }
1344 interface LoDashImplicitWrapper<TValue> {
1345 /**
1346 * @see _.isWeakSet
1347 */
1348 isWeakSet(): boolean;
1349 }
1350 interface LoDashExplicitWrapper<TValue> {
1351 /**
1352 * @see _.isWeakSet
1353 */
1354 isWeakSet(): PrimitiveChain<boolean>;
1355 }
1356
1357 interface LoDashStatic {
1358 /**
1359 * Checks if value is less than other.
1360 *
1361 * @param value The value to compare.
1362 * @param other The other value to compare.
1363 * @return Returns true if value is less than other, else false.
1364 */
1365 lt(value: any, other: any): boolean;
1366 }
1367 interface LoDashImplicitWrapper<TValue> {
1368 /**
1369 * @see _.lt
1370 */
1371 lt(other: any): boolean;
1372 }
1373 interface LoDashExplicitWrapper<TValue> {
1374 /**
1375 * @see _.lt
1376 */
1377 lt(other: any): PrimitiveChain<boolean>;
1378 }
1379
1380 interface LoDashStatic {
1381 /**
1382 * Checks if value is less than or equal to other.
1383 *
1384 * @param value The value to compare.
1385 * @param other The other value to compare.
1386 * @return Returns true if value is less than or equal to other, else false.
1387 */
1388 lte(value: any, other: any): boolean;
1389 }
1390 interface LoDashImplicitWrapper<TValue> {
1391 /**
1392 * @see _.lte
1393 */
1394 lte(other: any): boolean;
1395 }
1396 interface LoDashExplicitWrapper<TValue> {
1397 /**
1398 * @see _.lte
1399 */
1400 lte(other: any): PrimitiveChain<boolean>;
1401 }
1402
1403 interface LoDashStatic {
1404 /**
1405 * Converts value to an array.
1406 *
1407 * @param value The value to convert.
1408 * @return Returns the converted array.
1409 */
1410 toArray<T>(value: Dictionary<T> | NumericDictionary<T> | null | undefined): T[];
1411 /**
1412 * @see _.toArray
1413 */
1414 toArray<T>(value: T): Array<T[keyof T]>;
1415 /**
1416 * @see _.toArray
1417 */
1418 toArray(): any[];
1419 }
1420 interface String {
1421 /**
1422 * @see _.toArray
1423 */
1424 toArray(): Collection<string>;
1425 }
1426 interface Collection<T> {
1427 /**
1428 * @see _.toArray
1429 */
1430 toArray(): Collection<T>;
1431 }
1432 interface Object<T> {
1433 /**
1434 * @see _.toArray
1435 */
1436 toArray(): Collection<T[keyof T]>;
1437 }
1438 interface StringChain {
1439 /**
1440 * @see _.toArray
1441 */
1442 toArray(): CollectionChain<string>;
1443 }
1444 interface StringNullableChain {
1445 /**
1446 * @see _.toArray
1447 */
1448 toArray(): CollectionChain<string>;
1449 }
1450 interface CollectionChain<T> {
1451 /**
1452 * @see _.toArray
1453 */
1454 toArray(): CollectionChain<T>;
1455 }
1456 interface ObjectChain<T> {
1457 /**
1458 * @see _.toArray
1459 */
1460 toArray(): CollectionChain<T[keyof T]>;
1461 }
1462
1463 interface LoDashStatic {
1464 /**
1465 * Converts `value` to a finite number.
1466 *
1467 * @since 4.12.0
1468 * @category Lang
1469 * @param value The value to convert.
1470 * @returns Returns the converted number.
1471 * @example
1472 *
1473 * _.toFinite(3.2);
1474 * // => 3.2
1475 *
1476 * _.toFinite(Number.MIN_VALUE);
1477 * // => 5e-324
1478 *
1479 * _.toFinite(Infinity);
1480 * // => 1.7976931348623157e+308
1481 *
1482 * _.toFinite('3.2');
1483 * // => 3.2
1484 */
1485 toFinite(value: any): number;
1486 }
1487 interface LoDashImplicitWrapper<TValue> {
1488 /**
1489 * @see _.toFinite
1490 */
1491 toFinite(): number;
1492 }
1493 interface LoDashExplicitWrapper<TValue> {
1494 /**
1495 * @see _.toFinite
1496 */
1497 toFinite(): PrimitiveChain<number>;
1498 }
1499
1500 interface LoDashStatic {
1501 /**
1502 * Converts `value` to an integer.
1503 *
1504 * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
1505 *
1506 * @category Lang
1507 * @param value The value to convert.
1508 * @returns Returns the converted integer.
1509 * @example
1510 *
1511 * _.toInteger(3);
1512 * // => 3
1513 *
1514 * _.toInteger(Number.MIN_VALUE);
1515 * // => 0
1516 *
1517 * _.toInteger(Infinity);
1518 * // => 1.7976931348623157e+308
1519 *
1520 * _.toInteger('3');
1521 * // => 3
1522 */
1523 toInteger(value: any): number;
1524 }
1525 interface LoDashImplicitWrapper<TValue> {
1526 /**
1527 * @see _.toInteger
1528 */
1529 toInteger(): number;
1530 }
1531 interface LoDashExplicitWrapper<TValue> {
1532 /**
1533 * @see _.toInteger
1534 */
1535 toInteger(): PrimitiveChain<number>;
1536 }
1537
1538 interface LoDashStatic {
1539 /**
1540 * Converts `value` to an integer suitable for use as the length of an
1541 * array-like object.
1542 *
1543 * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
1544 *
1545 * @category Lang
1546 * @param value The value to convert.
1547 * @return Returns the converted integer.
1548 * @example
1549 *
1550 * _.toLength(3);
1551 * // => 3
1552 *
1553 * _.toLength(Number.MIN_VALUE);
1554 * // => 0
1555 *
1556 * _.toLength(Infinity);
1557 * // => 4294967295
1558 *
1559 * _.toLength('3');
1560 * // => 3
1561 */
1562 toLength(value: any): number;
1563 }
1564 interface LoDashImplicitWrapper<TValue> {
1565 /**
1566 * @see _.toLength
1567 */
1568 toLength(): number;
1569 }
1570 interface LoDashExplicitWrapper<TValue> {
1571 /**
1572 * @see _.toLength
1573 */
1574 toLength(): PrimitiveChain<number>;
1575 }
1576
1577 interface LoDashStatic {
1578 /**
1579 * Converts `value` to a number.
1580 *
1581 * @category Lang
1582 * @param value The value to process.
1583 * @returns Returns the number.
1584 * @example
1585 *
1586 * _.toNumber(3);
1587 * // => 3
1588 *
1589 * _.toNumber(Number.MIN_VALUE);
1590 * // => 5e-324
1591 *
1592 * _.toNumber(Infinity);
1593 * // => Infinity
1594 *
1595 * _.toNumber('3');
1596 * // => 3
1597 */
1598 toNumber(value: any): number;
1599 }
1600 interface LoDashImplicitWrapper<TValue> {
1601 /**
1602 * @see _.toNumber
1603 */
1604 toNumber(): number;
1605 }
1606 interface LoDashExplicitWrapper<TValue> {
1607 /**
1608 * @see _.toNumber
1609 */
1610 toNumber(): PrimitiveChain<number>;
1611 }
1612
1613 interface LoDashStatic {
1614 /**
1615 * Converts value to a plain object flattening inherited enumerable properties of value to own properties
1616 * of the plain object.
1617 *
1618 * @param value The value to convert.
1619 * @return Returns the converted plain object.
1620 */
1621 toPlainObject(value?: any): any;
1622 }
1623 interface LoDashImplicitWrapper<TValue> {
1624 /**
1625 * @see _.toPlainObject
1626 */
1627 toPlainObject(): Object<any>;
1628 }
1629 interface LoDashExplicitWrapper<TValue> {
1630 /**
1631 * @see _.toPlainObject
1632 */
1633 toPlainObject(): ObjectChain<any>;
1634 }
1635
1636 interface LoDashStatic {
1637 /**
1638 * Converts `value` to a safe integer. A safe integer can be compared and
1639 * represented correctly.
1640 *
1641 * @category Lang
1642 * @param value The value to convert.
1643 * @returns Returns the converted integer.
1644 * @example
1645 *
1646 * _.toSafeInteger(3);
1647 * // => 3
1648 *
1649 * _.toSafeInteger(Number.MIN_VALUE);
1650 * // => 0
1651 *
1652 * _.toSafeInteger(Infinity);
1653 * // => 9007199254740991
1654 *
1655 * _.toSafeInteger('3');
1656 * // => 3
1657 */
1658 toSafeInteger(value: any): number;
1659 }
1660 interface LoDashImplicitWrapper<TValue> {
1661 /**
1662 * @see _.toSafeInteger
1663 */
1664 toSafeInteger(): number;
1665 }
1666 interface LoDashExplicitWrapper<TValue> {
1667 /**
1668 * @see _.toSafeInteger
1669 */
1670 toSafeInteger(): PrimitiveChain<number>;
1671 }
1672
1673 interface LoDashStatic {
1674 /**
1675 * Converts `value` to a string if it's not one. An empty string is returned
1676 * for `null` and `undefined` values. The sign of `-0` is preserved.
1677 *
1678 * @category Lang
1679 * @param value The value to process.
1680 * @returns Returns the string.
1681 * @example
1682 *
1683 * _.toString(null);
1684 * // => ''
1685 *
1686 * _.toString(-0);
1687 * // => '-0'
1688 *
1689 * _.toString([1, 2, 3]);
1690 * // => '1,2,3'
1691 */
1692 toString(value: any): string;
1693 }
1694}