UNPKG

48.7 kBTypeScriptView Raw
1import _ = require("../index");
2// eslint-disable-next-line @definitelytyped/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 type EmptyObject<T> = { [K in keyof T]?: never };
565 type EmptyObjectOf<T> = EmptyObject<T> extends T ? EmptyObject<T> : never;
566 interface LoDashStatic {
567 /**
568 * Checks if value is empty. A value is considered empty unless its an arguments object, array, string, or
569 * jQuery-like collection with a length greater than 0 or an object with own enumerable properties.
570 *
571 * @param value The value to inspect.
572 * @return Returns true if value is empty, else false.
573 */
574 isEmpty<T extends { __trapAny: any }>(value?: T): boolean;
575 isEmpty(value: string): value is '';
576 isEmpty(value: Map<any, any> | Set<any> | List<any> | null | undefined): boolean;
577 isEmpty(value: object): boolean;
578 isEmpty<T extends object>(value: T | null | undefined): value is EmptyObjectOf<T> | null | undefined;
579 isEmpty(value?: any): boolean;
580 }
581 interface LoDashImplicitWrapper<TValue> {
582 /**
583 * @see _.isEmpty
584 */
585 isEmpty(): boolean;
586 }
587 interface LoDashExplicitWrapper<TValue> {
588 /**
589 * @see _.isEmpty
590 */
591 isEmpty(): PrimitiveChain<boolean>;
592 }
593
594 interface LoDashStatic {
595 /**
596 * Performs a deep comparison between two values to determine if they are
597 * equivalent.
598 *
599 * **Note:** This method supports comparing arrays, array buffers, booleans,
600 * date objects, error objects, maps, numbers, `Object` objects, regexes,
601 * sets, strings, symbols, and typed arrays. `Object` objects are compared
602 * by their own, not inherited, enumerable properties. Functions and DOM
603 * nodes are **not** supported.
604 *
605 * @category Lang
606 * @param value The value to compare.
607 * @param other The other value to compare.
608 * @returns Returns `true` if the values are equivalent, else `false`.
609 * @example
610 *
611 * var object = { 'user': 'fred' };
612 * var other = { 'user': 'fred' };
613 *
614 * _.isEqual(object, other);
615 * // => true
616 *
617 * object === other;
618 * // => false
619 */
620 isEqual(value: any, other: any): boolean;
621 }
622 interface LoDashImplicitWrapper<TValue> {
623 /**
624 * @see _.isEqual
625 */
626 isEqual(other: any): boolean;
627 }
628 interface LoDashExplicitWrapper<TValue> {
629 /**
630 * @see _.isEqual
631 */
632 isEqual(other: any): PrimitiveChain<boolean>;
633 }
634
635 type IsEqualCustomizer = (value: any, other: any, indexOrKey: PropertyName | undefined, parent: any, otherParent: any, stack: any) => boolean | undefined;
636 interface LoDashStatic {
637 /**
638 * This method is like `_.isEqual` except that it accepts `customizer` which is
639 * invoked to compare values. If `customizer` returns `undefined` comparisons are
640 * handled by the method instead. The `customizer` is invoked with up to seven arguments:
641 * (objValue, othValue [, index|key, object, other, stack]).
642 *
643 * @category Lang
644 * @param value The value to compare.
645 * @param other The other value to compare.
646 * @param [customizer] The function to customize comparisons.
647 * @returns Returns `true` if the values are equivalent, else `false`.
648 * @example
649 *
650 * function isGreeting(value) {
651 * return /^h(?:i|ello)$/.test(value);
652 * }
653 *
654 * function customizer(objValue, othValue) {
655 * if (isGreeting(objValue) && isGreeting(othValue)) {
656 * return true;
657 * }
658 * }
659 *
660 * var array = ['hello', 'goodbye'];
661 * var other = ['hi', 'goodbye'];
662 *
663 * _.isEqualWith(array, other, customizer);
664 * // => true
665 */
666 isEqualWith(value: any, other: any, customizer?: IsEqualCustomizer): boolean;
667 }
668 interface LoDashImplicitWrapper<TValue> {
669 /**
670 * @see _.isEqualWith
671 */
672 isEqualWith(other: any, customizer?: IsEqualCustomizer): boolean;
673 }
674 interface LoDashExplicitWrapper<TValue> {
675 /**
676 * @see _.isEqualWith
677 */
678 isEqualWith(other: any, customizer?: IsEqualCustomizer): PrimitiveChain<boolean>;
679 }
680
681 interface LoDashStatic {
682 /**
683 * Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError
684 * object.
685 *
686 * @param value The value to check.
687 * @return Returns true if value is an error object, else false.
688 */
689 isError(value: any): value is Error;
690 }
691 interface LoDashImplicitWrapper<TValue> {
692 /**
693 * @see _.isError
694 */
695 isError(): boolean;
696 }
697 interface LoDashExplicitWrapper<TValue> {
698 /**
699 * @see _.isError
700 */
701 isError(): PrimitiveChain<boolean>;
702 }
703
704 interface LoDashStatic {
705 /**
706 * Checks if value is a finite primitive number.
707 *
708 * Note: This method is based on Number.isFinite.
709 *
710 * @param value The value to check.
711 * @return Returns true if value is a finite number, else false.
712 */
713 isFinite(value?: any): boolean;
714 }
715 interface LoDashImplicitWrapper<TValue> {
716 /**
717 * @see _.isFinite
718 */
719 isFinite(): boolean;
720 }
721 interface LoDashExplicitWrapper<TValue> {
722 /**
723 * @see _.isFinite
724 */
725 isFinite(): PrimitiveChain<boolean>;
726 }
727
728 interface LoDashStatic {
729 /**
730 * Checks if value is a callable function.
731 *
732 * @param value The value to check.
733 * @return Returns true if value is correctly classified, else false.
734 */
735 isFunction(value: any): value is (...args: any[]) => any;
736 }
737 interface LoDashImplicitWrapper<TValue> {
738 /**
739 * @see _.isFunction
740 */
741 isFunction(): boolean;
742 }
743 interface LoDashExplicitWrapper<TValue> {
744 /**
745 * @see _.isFunction
746 */
747 isFunction(): PrimitiveChain<boolean>;
748 }
749
750 interface LoDashStatic {
751 /**
752 * Checks if `value` is an integer.
753 *
754 * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger).
755 *
756 * @category Lang
757 * @param value The value to check.
758 * @returns Returns `true` if `value` is an integer, else `false`.
759 * @example
760 *
761 * _.isInteger(3);
762 * // => true
763 *
764 * _.isInteger(Number.MIN_VALUE);
765 * // => false
766 *
767 * _.isInteger(Infinity);
768 * // => false
769 *
770 * _.isInteger('3');
771 * // => false
772 */
773 isInteger(value?: any): boolean;
774 }
775 interface LoDashImplicitWrapper<TValue> {
776 /**
777 * @see _.isInteger
778 */
779 isInteger(): boolean;
780 }
781 interface LoDashExplicitWrapper<TValue> {
782 /**
783 * @see _.isInteger
784 */
785 isInteger(): PrimitiveChain<boolean>;
786 }
787
788 interface LoDashStatic {
789 /**
790 * Checks if `value` is a valid array-like length.
791 *
792 * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
793 *
794 * @category Lang
795 * @param value The value to check.
796 * @returns Returns `true` if `value` is a valid length, else `false`.
797 * @example
798 *
799 * _.isLength(3);
800 * // => true
801 *
802 * _.isLength(Number.MIN_VALUE);
803 * // => false
804 *
805 * _.isLength(Infinity);
806 * // => false
807 *
808 * _.isLength('3');
809 * // => false
810 */
811 isLength(value?: any): boolean;
812 }
813 interface LoDashImplicitWrapper<TValue> {
814 /**
815 * @see _.isLength
816 */
817 isLength(): boolean;
818 }
819 interface LoDashExplicitWrapper<TValue> {
820 /**
821 * @see _.isLength
822 */
823 isLength(): PrimitiveChain<boolean>;
824 }
825
826 interface LoDashStatic {
827 /**
828 * Checks if value is classified as a Map object.
829 *
830 * @param value The value to check.
831 * @returns Returns true if value is correctly classified, else false.
832 */
833 isMap(value?: any): value is Map<any, any>;
834 }
835 interface LoDashImplicitWrapper<TValue> {
836 /**
837 * @see _.isMap
838 */
839 isMap(): boolean;
840 }
841 interface LoDashExplicitWrapper<TValue> {
842 /**
843 * @see _.isMap
844 */
845 isMap(): PrimitiveChain<boolean>;
846 }
847
848 interface LoDashStatic {
849 /**
850 * Performs a deep comparison between `object` and `source` to determine if
851 * `object` contains equivalent property values.
852 *
853 * **Note:** This method supports comparing the same values as `_.isEqual`.
854 *
855 * @category Lang
856 * @param object The object to inspect.
857 * @param source The object of property values to match.
858 * @returns Returns `true` if `object` is a match, else `false`.
859 * @example
860 *
861 * var object = { 'user': 'fred', 'age': 40 };
862 *
863 * _.isMatch(object, { 'age': 40 });
864 * // => true
865 *
866 * _.isMatch(object, { 'age': 36 });
867 * // => false
868 */
869 isMatch(object: object, source: object): boolean;
870 }
871 interface LoDashImplicitWrapper<TValue> {
872 /**
873 * @see _.isMatch
874 */
875 isMatch(source: object): boolean;
876 }
877 interface LoDashExplicitWrapper<TValue> {
878 /**
879 * @see _.isMatch
880 */
881 isMatch(source: object): PrimitiveChain<boolean>;
882 }
883
884 type isMatchWithCustomizer = (value: any, other: any, indexOrKey: PropertyName, object: object, source: object) => boolean | undefined;
885 interface LoDashStatic {
886 /**
887 * This method is like `_.isMatch` except that it accepts `customizer` which
888 * is invoked to compare values. If `customizer` returns `undefined` comparisons
889 * are handled by the method instead. The `customizer` is invoked with three
890 * arguments: (objValue, srcValue, index|key, object, source).
891 *
892 * @category Lang
893 * @param object The object to inspect.
894 * @param source The object of property values to match.
895 * @param [customizer] The function to customize comparisons.
896 * @returns Returns `true` if `object` is a match, else `false`.
897 * @example
898 *
899 * function isGreeting(value) {
900 * return /^h(?:i|ello)$/.test(value);
901 * }
902 *
903 * function customizer(objValue, srcValue) {
904 * if (isGreeting(objValue) && isGreeting(srcValue)) {
905 * return true;
906 * }
907 * }
908 *
909 * var object = { 'greeting': 'hello' };
910 * var source = { 'greeting': 'hi' };
911 *
912 * _.isMatchWith(object, source, customizer);
913 * // => true
914 */
915 isMatchWith(object: object, source: object, customizer: isMatchWithCustomizer): boolean;
916 }
917 interface LoDashImplicitWrapper<TValue> {
918 /**
919 * @see _.isMatchWith
920 */
921 isMatchWith(source: object, customizer: isMatchWithCustomizer): boolean;
922 }
923 interface LoDashExplicitWrapper<TValue> {
924 /**
925 * @see _.isMatchWith
926 */
927 isMatchWith(source: object, customizer: isMatchWithCustomizer): PrimitiveChain<boolean>;
928 }
929
930 interface LoDashStatic {
931 /**
932 * Checks if value is NaN.
933 *
934 * Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values.
935 *
936 * @param value The value to check.
937 * @return Returns true if value is NaN, else false.
938 */
939 isNaN(value?: any): boolean;
940 }
941 interface LoDashImplicitWrapper<TValue> {
942 /**
943 * @see _.isNaN
944 */
945 isNaN(): boolean;
946 }
947 interface LoDashExplicitWrapper<TValue> {
948 /**
949 * @see _.isNaN
950 */
951 isNaN(): PrimitiveChain<boolean>;
952 }
953
954 interface LoDashStatic {
955 /**
956 * Checks if value is a native function.
957 * @param value The value to check.
958 *
959 * @return Returns true if value is a native function, else false.
960 */
961 isNative(value: any): value is (...args: any[]) => any;
962 }
963 interface LoDashImplicitWrapper<TValue> {
964 /**
965 * @see _.isNative
966 */
967 isNative(): boolean;
968 }
969 interface LoDashExplicitWrapper<TValue> {
970 /**
971 * @see _.isNative
972 */
973 isNative(): PrimitiveChain<boolean>;
974 }
975
976 interface LoDashStatic {
977 /**
978 * Checks if `value` is `null` or `undefined`.
979 *
980 * @category Lang
981 * @param value The value to check.
982 * @returns Returns `true` if `value` is nullish, else `false`.
983 * @example
984 *
985 * _.isNil(null);
986 * // => true
987 *
988 * _.isNil(void 0);
989 * // => true
990 *
991 * _.isNil(NaN);
992 * // => false
993 */
994 isNil(value: any): value is null | undefined;
995 }
996 interface LoDashImplicitWrapper<TValue> {
997 /**
998 * @see _.isNil
999 */
1000 isNil(): boolean;
1001 }
1002 interface LoDashExplicitWrapper<TValue> {
1003 /**
1004 * @see _.isNil
1005 */
1006 isNil(): PrimitiveChain<boolean>;
1007 }
1008
1009 interface LoDashStatic {
1010 /**
1011 * Checks if value is null.
1012 *
1013 * @param value The value to check.
1014 * @return Returns true if value is null, else false.
1015 */
1016 isNull(value: any): value is null;
1017 }
1018 interface LoDashImplicitWrapper<TValue> {
1019 /**
1020 * @see _.isNull
1021 */
1022 isNull(): boolean;
1023 }
1024 interface LoDashExplicitWrapper<TValue> {
1025 /**
1026 * @see _.isNull
1027 */
1028 isNull(): PrimitiveChain<boolean>;
1029 }
1030
1031 interface LoDashStatic {
1032 /**
1033 * Checks if value is classified as a Number primitive or object.
1034 *
1035 * Note: To exclude Infinity, -Infinity, and NaN, which are classified as numbers, use the _.isFinite method.
1036 *
1037 * @param value The value to check.
1038 * @return Returns true if value is correctly classified, else false.
1039 */
1040 isNumber(value?: any): value is number;
1041 }
1042 interface LoDashImplicitWrapper<TValue> {
1043 /**
1044 * @see _.isNumber
1045 */
1046 isNumber(): boolean;
1047 }
1048 interface LoDashExplicitWrapper<TValue> {
1049 /**
1050 * @see _.isNumber
1051 */
1052 isNumber(): PrimitiveChain<boolean>;
1053 }
1054
1055 interface LoDashStatic {
1056 /**
1057 * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0),
1058 * and new String(''))
1059 *
1060 * @param value The value to check.
1061 * @return Returns true if value is an object, else false.
1062 */
1063 isObject(value?: any): value is object;
1064 }
1065 interface LoDashImplicitWrapper<TValue> {
1066 /**
1067 * @see _.isObject
1068 */
1069 isObject(): this is LoDashImplicitWrapper<object>;
1070 }
1071 interface LoDashExplicitWrapper<TValue> {
1072 /**
1073 * @see _.isObject
1074 */
1075 isObject(): PrimitiveChain<boolean>;
1076 }
1077
1078 interface LoDashStatic {
1079 /**
1080 * Checks if `value` is object-like. A value is object-like if it's not `null`
1081 * and has a `typeof` result of "object".
1082 *
1083 * @category Lang
1084 * @param value The value to check.
1085 * @returns Returns `true` if `value` is object-like, else `false`.
1086 * @example
1087 *
1088 * _.isObjectLike({});
1089 * // => true
1090 *
1091 * _.isObjectLike([1, 2, 3]);
1092 * // => true
1093 *
1094 * _.isObjectLike(_.noop);
1095 * // => false
1096 *
1097 * _.isObjectLike(null);
1098 * // => false
1099 */
1100 isObjectLike(value?: any): boolean;
1101 }
1102 interface LoDashImplicitWrapper<TValue> {
1103 /**
1104 * @see _.isObjectLike
1105 */
1106 isObjectLike(): boolean;
1107 }
1108 interface LoDashExplicitWrapper<TValue> {
1109 /**
1110 * @see _.isObjectLike
1111 */
1112 isObjectLike(): PrimitiveChain<boolean>;
1113 }
1114
1115 interface LoDashStatic {
1116 /**
1117 * Checks if value is a plain object, that is, an object created by the Object constructor or one with a
1118 * [[Prototype]] of null.
1119 *
1120 * Note: This method assumes objects created by the Object constructor have no inherited enumerable properties.
1121 *
1122 * @param value The value to check.
1123 * @return Returns true if value is a plain object, else false.
1124 */
1125 isPlainObject(value?: any): boolean;
1126 }
1127 interface LoDashImplicitWrapper<TValue> {
1128 /**
1129 * @see _.isPlainObject
1130 */
1131 isPlainObject(): boolean;
1132 }
1133 interface LoDashExplicitWrapper<TValue> {
1134 /**
1135 * @see _.isPlainObject
1136 */
1137 isPlainObject(): PrimitiveChain<boolean>;
1138 }
1139
1140 interface LoDashStatic {
1141 /**
1142 * Checks if value is classified as a RegExp object.
1143 * @param value The value to check.
1144 *
1145 * @return Returns true if value is correctly classified, else false.
1146 */
1147 isRegExp(value?: any): value is RegExp;
1148 }
1149 interface LoDashImplicitWrapper<TValue> {
1150 /**
1151 * @see _.isRegExp
1152 */
1153 isRegExp(): boolean;
1154 }
1155 interface LoDashExplicitWrapper<TValue> {
1156 /**
1157 * @see _.isRegExp
1158 */
1159 isRegExp(): PrimitiveChain<boolean>;
1160 }
1161
1162 interface LoDashStatic {
1163 /**
1164 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
1165 * double precision number which isn't the result of a rounded unsafe integer.
1166 *
1167 * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
1168 *
1169 * @category Lang
1170 * @param value The value to check.
1171 * @returns Returns `true` if `value` is a safe integer, else `false`.
1172 * @example
1173 *
1174 * _.isSafeInteger(3);
1175 * // => true
1176 *
1177 * _.isSafeInteger(Number.MIN_VALUE);
1178 * // => false
1179 *
1180 * _.isSafeInteger(Infinity);
1181 * // => false
1182 *
1183 * _.isSafeInteger('3');
1184 * // => false
1185 */
1186 isSafeInteger(value: any): boolean;
1187 }
1188 interface LoDashImplicitWrapper<TValue> {
1189 /**
1190 * @see _.isSafeInteger
1191 */
1192 isSafeInteger(): boolean;
1193 }
1194 interface LoDashExplicitWrapper<TValue> {
1195 /**
1196 * @see _.isSafeInteger
1197 */
1198 isSafeInteger(): PrimitiveChain<boolean>;
1199 }
1200
1201 interface LoDashStatic {
1202 /**
1203 * Checks if value is classified as a Set object.
1204 *
1205 * @param value The value to check.
1206 * @returns Returns true if value is correctly classified, else false.
1207 */
1208 isSet(value?: any): value is Set<any>;
1209 }
1210 interface LoDashImplicitWrapper<TValue> {
1211 /**
1212 * @see _.isSet
1213 */
1214 isSet(): boolean;
1215 }
1216 interface LoDashExplicitWrapper<TValue> {
1217 /**
1218 * @see _.isSet
1219 */
1220 isSet(): PrimitiveChain<boolean>;
1221 }
1222
1223 interface LoDashStatic {
1224 /**
1225 * Checks if value is classified as a String primitive or object.
1226 *
1227 * @param value The value to check.
1228 * @return Returns true if value is correctly classified, else false.
1229 */
1230 isString(value?: any): value is string;
1231 }
1232 interface LoDashImplicitWrapper<TValue> {
1233 /**
1234 * @see _.isString
1235 */
1236 isString(): boolean;
1237 }
1238 interface LoDashExplicitWrapper<TValue> {
1239 /**
1240 * @see _.isString
1241 */
1242 isString(): PrimitiveChain<boolean>;
1243 }
1244
1245 interface LoDashStatic {
1246 /**
1247 * Checks if `value` is classified as a `Symbol` primitive or object.
1248 *
1249 * @category Lang
1250 * @param value The value to check.
1251 * @returns Returns `true` if `value` is correctly classified, else `false`.
1252 * @example
1253 *
1254 * _.isSymbol(Symbol.iterator);
1255 * // => true
1256 *
1257 * _.isSymbol('abc');
1258 * // => false
1259 */
1260 isSymbol(value: any): value is symbol;
1261 }
1262 interface LoDashImplicitWrapper<TValue> {
1263 /**
1264 * @see _.isSymbol
1265 */
1266 isSymbol(): boolean;
1267 }
1268 interface LoDashExplicitWrapper<TValue> {
1269 /**
1270 * @see _.isSymbol
1271 */
1272 isSymbol(): PrimitiveChain<boolean>;
1273 }
1274
1275 interface LoDashStatic {
1276 /**
1277 * Checks if value is classified as a typed array.
1278 *
1279 * @param value The value to check.
1280 * @return Returns true if value is correctly classified, else false.
1281 */
1282 isTypedArray(value: any): boolean;
1283 }
1284 interface LoDashImplicitWrapper<TValue> {
1285 /**
1286 * @see _.isTypedArray
1287 */
1288 isTypedArray(): boolean;
1289 }
1290 interface LoDashExplicitWrapper<TValue> {
1291 /**
1292 * @see _.isTypedArray
1293 */
1294 isTypedArray(): PrimitiveChain<boolean>;
1295 }
1296
1297 interface LoDashStatic {
1298 /**
1299 * Checks if value is undefined.
1300 *
1301 * @param value The value to check.
1302 * @return Returns true if value is undefined, else false.
1303 */
1304 isUndefined(value: any): value is undefined;
1305 }
1306 interface LoDashImplicitWrapper<TValue> {
1307 /**
1308 * @see _.isUndefined
1309 */
1310 isUndefined(): boolean;
1311 }
1312 interface LoDashExplicitWrapper<TValue> {
1313 /**
1314 * @see _.isUndefined
1315 */
1316 isUndefined(): PrimitiveChain<boolean>;
1317 }
1318
1319 interface LoDashStatic {
1320 /**
1321 * Checks if value is classified as a WeakMap object.
1322 *
1323 * @param value The value to check.
1324 * @returns Returns true if value is correctly classified, else false.
1325 */
1326 isWeakMap(value?: any): value is WeakMap<object, any>;
1327 }
1328 interface LoDashImplicitWrapper<TValue> {
1329 /**
1330 * @see _.isWeakMap
1331 */
1332 isWeakMap(): boolean;
1333 }
1334 interface LoDashExplicitWrapper<TValue> {
1335 /**
1336 * @see _.isWeakMap
1337 */
1338 isWeakMap(): PrimitiveChain<boolean>;
1339 }
1340
1341 interface LoDashStatic {
1342 /**
1343 * Checks if value is classified as a WeakSet object.
1344 *
1345 * @param value The value to check.
1346 * @returns Returns true if value is correctly classified, else false.
1347 */
1348 isWeakSet(value?: any): value is WeakSet<object>;
1349 }
1350 interface LoDashImplicitWrapper<TValue> {
1351 /**
1352 * @see _.isWeakSet
1353 */
1354 isWeakSet(): boolean;
1355 }
1356 interface LoDashExplicitWrapper<TValue> {
1357 /**
1358 * @see _.isWeakSet
1359 */
1360 isWeakSet(): PrimitiveChain<boolean>;
1361 }
1362
1363 interface LoDashStatic {
1364 /**
1365 * Checks if value is less than other.
1366 *
1367 * @param value The value to compare.
1368 * @param other The other value to compare.
1369 * @return Returns true if value is less than other, else false.
1370 */
1371 lt(value: any, other: any): boolean;
1372 }
1373 interface LoDashImplicitWrapper<TValue> {
1374 /**
1375 * @see _.lt
1376 */
1377 lt(other: any): boolean;
1378 }
1379 interface LoDashExplicitWrapper<TValue> {
1380 /**
1381 * @see _.lt
1382 */
1383 lt(other: any): PrimitiveChain<boolean>;
1384 }
1385
1386 interface LoDashStatic {
1387 /**
1388 * Checks if value is less than or equal to other.
1389 *
1390 * @param value The value to compare.
1391 * @param other The other value to compare.
1392 * @return Returns true if value is less than or equal to other, else false.
1393 */
1394 lte(value: any, other: any): boolean;
1395 }
1396 interface LoDashImplicitWrapper<TValue> {
1397 /**
1398 * @see _.lte
1399 */
1400 lte(other: any): boolean;
1401 }
1402 interface LoDashExplicitWrapper<TValue> {
1403 /**
1404 * @see _.lte
1405 */
1406 lte(other: any): PrimitiveChain<boolean>;
1407 }
1408
1409 interface LoDashStatic {
1410 /**
1411 * Converts value to an array.
1412 *
1413 * @param value The value to convert.
1414 * @return Returns the converted array.
1415 */
1416 toArray<T>(value: Dictionary<T> | NumericDictionary<T> | null | undefined): T[];
1417 /**
1418 * @see _.toArray
1419 */
1420 toArray<T>(value: T): Array<T[keyof T]>;
1421 /**
1422 * @see _.toArray
1423 */
1424 toArray(): any[];
1425 }
1426 interface String {
1427 /**
1428 * @see _.toArray
1429 */
1430 toArray(): Collection<string>;
1431 }
1432 interface Collection<T> {
1433 /**
1434 * @see _.toArray
1435 */
1436 toArray(): Collection<T>;
1437 }
1438 interface Object<T> {
1439 /**
1440 * @see _.toArray
1441 */
1442 toArray(): Collection<T[keyof T]>;
1443 }
1444 interface StringChain {
1445 /**
1446 * @see _.toArray
1447 */
1448 toArray(): CollectionChain<string>;
1449 }
1450 interface StringNullableChain {
1451 /**
1452 * @see _.toArray
1453 */
1454 toArray(): CollectionChain<string>;
1455 }
1456 interface CollectionChain<T> {
1457 /**
1458 * @see _.toArray
1459 */
1460 toArray(): CollectionChain<T>;
1461 }
1462 interface ObjectChain<T> {
1463 /**
1464 * @see _.toArray
1465 */
1466 toArray(): CollectionChain<T[keyof T]>;
1467 }
1468
1469 interface LoDashStatic {
1470 /**
1471 * Converts `value` to a finite number.
1472 *
1473 * @since 4.12.0
1474 * @category Lang
1475 * @param value The value to convert.
1476 * @returns Returns the converted number.
1477 * @example
1478 *
1479 * _.toFinite(3.2);
1480 * // => 3.2
1481 *
1482 * _.toFinite(Number.MIN_VALUE);
1483 * // => 5e-324
1484 *
1485 * _.toFinite(Infinity);
1486 * // => 1.7976931348623157e+308
1487 *
1488 * _.toFinite('3.2');
1489 * // => 3.2
1490 */
1491 toFinite(value: any): number;
1492 }
1493 interface LoDashImplicitWrapper<TValue> {
1494 /**
1495 * @see _.toFinite
1496 */
1497 toFinite(): number;
1498 }
1499 interface LoDashExplicitWrapper<TValue> {
1500 /**
1501 * @see _.toFinite
1502 */
1503 toFinite(): PrimitiveChain<number>;
1504 }
1505
1506 interface LoDashStatic {
1507 /**
1508 * Converts `value` to an integer.
1509 *
1510 * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
1511 *
1512 * @category Lang
1513 * @param value The value to convert.
1514 * @returns Returns the converted integer.
1515 * @example
1516 *
1517 * _.toInteger(3);
1518 * // => 3
1519 *
1520 * _.toInteger(Number.MIN_VALUE);
1521 * // => 0
1522 *
1523 * _.toInteger(Infinity);
1524 * // => 1.7976931348623157e+308
1525 *
1526 * _.toInteger('3');
1527 * // => 3
1528 */
1529 toInteger(value: any): number;
1530 }
1531 interface LoDashImplicitWrapper<TValue> {
1532 /**
1533 * @see _.toInteger
1534 */
1535 toInteger(): number;
1536 }
1537 interface LoDashExplicitWrapper<TValue> {
1538 /**
1539 * @see _.toInteger
1540 */
1541 toInteger(): PrimitiveChain<number>;
1542 }
1543
1544 interface LoDashStatic {
1545 /**
1546 * Converts `value` to an integer suitable for use as the length of an
1547 * array-like object.
1548 *
1549 * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
1550 *
1551 * @category Lang
1552 * @param value The value to convert.
1553 * @return Returns the converted integer.
1554 * @example
1555 *
1556 * _.toLength(3);
1557 * // => 3
1558 *
1559 * _.toLength(Number.MIN_VALUE);
1560 * // => 0
1561 *
1562 * _.toLength(Infinity);
1563 * // => 4294967295
1564 *
1565 * _.toLength('3');
1566 * // => 3
1567 */
1568 toLength(value: any): number;
1569 }
1570 interface LoDashImplicitWrapper<TValue> {
1571 /**
1572 * @see _.toLength
1573 */
1574 toLength(): number;
1575 }
1576 interface LoDashExplicitWrapper<TValue> {
1577 /**
1578 * @see _.toLength
1579 */
1580 toLength(): PrimitiveChain<number>;
1581 }
1582
1583 interface LoDashStatic {
1584 /**
1585 * Converts `value` to a number.
1586 *
1587 * @category Lang
1588 * @param value The value to process.
1589 * @returns Returns the number.
1590 * @example
1591 *
1592 * _.toNumber(3);
1593 * // => 3
1594 *
1595 * _.toNumber(Number.MIN_VALUE);
1596 * // => 5e-324
1597 *
1598 * _.toNumber(Infinity);
1599 * // => Infinity
1600 *
1601 * _.toNumber('3');
1602 * // => 3
1603 */
1604 toNumber(value: any): number;
1605 }
1606 interface LoDashImplicitWrapper<TValue> {
1607 /**
1608 * @see _.toNumber
1609 */
1610 toNumber(): number;
1611 }
1612 interface LoDashExplicitWrapper<TValue> {
1613 /**
1614 * @see _.toNumber
1615 */
1616 toNumber(): PrimitiveChain<number>;
1617 }
1618
1619 interface LoDashStatic {
1620 /**
1621 * Converts value to a plain object flattening inherited enumerable properties of value to own properties
1622 * of the plain object.
1623 *
1624 * @param value The value to convert.
1625 * @return Returns the converted plain object.
1626 */
1627 toPlainObject(value?: any): any;
1628 }
1629 interface LoDashImplicitWrapper<TValue> {
1630 /**
1631 * @see _.toPlainObject
1632 */
1633 toPlainObject(): Object<any>;
1634 }
1635 interface LoDashExplicitWrapper<TValue> {
1636 /**
1637 * @see _.toPlainObject
1638 */
1639 toPlainObject(): ObjectChain<any>;
1640 }
1641
1642 interface LoDashStatic {
1643 /**
1644 * Converts `value` to a safe integer. A safe integer can be compared and
1645 * represented correctly.
1646 *
1647 * @category Lang
1648 * @param value The value to convert.
1649 * @returns Returns the converted integer.
1650 * @example
1651 *
1652 * _.toSafeInteger(3);
1653 * // => 3
1654 *
1655 * _.toSafeInteger(Number.MIN_VALUE);
1656 * // => 0
1657 *
1658 * _.toSafeInteger(Infinity);
1659 * // => 9007199254740991
1660 *
1661 * _.toSafeInteger('3');
1662 * // => 3
1663 */
1664 toSafeInteger(value: any): number;
1665 }
1666 interface LoDashImplicitWrapper<TValue> {
1667 /**
1668 * @see _.toSafeInteger
1669 */
1670 toSafeInteger(): number;
1671 }
1672 interface LoDashExplicitWrapper<TValue> {
1673 /**
1674 * @see _.toSafeInteger
1675 */
1676 toSafeInteger(): PrimitiveChain<number>;
1677 }
1678
1679 interface LoDashStatic {
1680 /**
1681 * Converts `value` to a string if it's not one. An empty string is returned
1682 * for `null` and `undefined` values. The sign of `-0` is preserved.
1683 *
1684 * @category Lang
1685 * @param value The value to process.
1686 * @returns Returns the string.
1687 * @example
1688 *
1689 * _.toString(null);
1690 * // => ''
1691 *
1692 * _.toString(-0);
1693 * // => '-0'
1694 *
1695 * _.toString([1, 2, 3]);
1696 * // => '1,2,3'
1697 */
1698 toString(value: any): string;
1699 }
1700}