Types/lodash -- update with new functions (#18738)

* feat(lodash): update types and list of lodash functions

* fix: add missing typings for flatMapDepth

* test(lodash): update test with newly added function

Note: pullAllWith is not included

* fix: add missing entries in tsconfig.json

* feat: add and generate new modules

* fix(lodash): improve typings

* fix: update with latest flatMap types

* fix(lodash): remove redundant types for updateWith method

* fix(lodash): improve types of flatMapDeep and flatMapDepth and tests

replace Many with ListOfRecursiveArraysOrValues
This commit is contained in:
Scott
2017-09-25 13:55:37 -07:00
committed by Mohamed Hegazy
parent ff54e80074
commit a96d185882
53 changed files with 1397 additions and 26 deletions
+2
View File
@@ -0,0 +1,2 @@
import { cond } from "lodash";
export default cond;
+2
View File
@@ -0,0 +1,2 @@
import { divide } from "lodash";
export default divide;
+2
View File
@@ -0,0 +1,2 @@
import { entries } from "lodash";
export default entries;
+2
View File
@@ -0,0 +1,2 @@
import { entriesIn } from "lodash";
export default entriesIn;
+2
View File
@@ -0,0 +1,2 @@
import { flatMapDeep } from "lodash";
export default flatMapDeep;
+2
View File
@@ -0,0 +1,2 @@
import { flatMapDepth } from "lodash";
export default flatMapDepth;
+13 -2
View File
@@ -33,6 +33,7 @@ export {
cloneWith,
compact,
concat,
cond,
constant,
countBy,
create,
@@ -47,6 +48,7 @@ export {
difference,
differenceBy,
differenceWith,
divide,
drop,
dropRight,
dropRightWhile,
@@ -54,6 +56,8 @@ export {
each,
eachRight,
endsWith,
entries,
entriesIn,
eq,
escape,
escapeRegExp,
@@ -70,6 +74,8 @@ export {
findLastKey,
first,
flatMap,
flatMapDeep,
flatMapDepth,
flatten,
flattenDeep,
flattenDepth,
@@ -94,10 +100,10 @@ export {
hasIn,
head,
identity,
inRange,
includes,
indexOf,
initial,
inRange,
intersection,
intersectionBy,
intersectionWith,
@@ -175,6 +181,7 @@ export {
noConflict,
noop,
now,
nth,
nthArg,
omit,
omitBy,
@@ -198,6 +205,7 @@ export {
pull,
pullAll,
pullAllBy,
pullAllWith,
pullAt,
random,
range,
@@ -250,6 +258,7 @@ export {
thru,
times,
toArray,
toFinite,
toInteger,
toLength,
toLower,
@@ -273,12 +282,13 @@ export {
unionWith,
uniq,
uniqBy,
uniqWith,
uniqueId,
uniqWith,
unset,
unzip,
unzipWith,
update,
updateWith,
upperCase,
upperFirst,
values,
@@ -291,5 +301,6 @@ export {
xorWith,
zip,
zipObject,
zipObjectDeep,
zipWith
} from "lodash";
+2
View File
@@ -0,0 +1,2 @@
import { nth } from "lodash";
export default nth;
+2
View File
@@ -0,0 +1,2 @@
import { pullAllWith } from "lodash";
export default pullAllWith;
+2
View File
@@ -0,0 +1,2 @@
import { toFinite } from "lodash";
export default toFinite;
+13 -2
View File
@@ -44,6 +44,7 @@
"cloneWith.d.ts",
"compact.d.ts",
"concat.d.ts",
"cond.d.ts",
"constant.d.ts",
"countBy.d.ts",
"create.d.ts",
@@ -58,6 +59,7 @@
"difference.d.ts",
"differenceBy.d.ts",
"differenceWith.d.ts",
"divide.d.ts",
"drop.d.ts",
"dropRight.d.ts",
"dropRightWhile.d.ts",
@@ -65,6 +67,8 @@
"each.d.ts",
"eachRight.d.ts",
"endsWith.d.ts",
"entries.d.ts",
"entriesIn.d.ts",
"eq.d.ts",
"escape.d.ts",
"escapeRegExp.d.ts",
@@ -81,6 +85,8 @@
"findLastKey.d.ts",
"first.d.ts",
"flatMap.d.ts",
"flatMapDeep.d.ts",
"flatMapDepth.d.ts",
"flatten.d.ts",
"flattenDeep.d.ts",
"flattenDepth.d.ts",
@@ -105,10 +111,10 @@
"hasIn.d.ts",
"head.d.ts",
"identity.d.ts",
"inRange.d.ts",
"includes.d.ts",
"indexOf.d.ts",
"initial.d.ts",
"inRange.d.ts",
"intersection.d.ts",
"intersectionBy.d.ts",
"intersectionWith.d.ts",
@@ -186,6 +192,7 @@
"noConflict.d.ts",
"noop.d.ts",
"now.d.ts",
"nth.d.ts",
"nthArg.d.ts",
"omit.d.ts",
"omitBy.d.ts",
@@ -209,6 +216,7 @@
"pull.d.ts",
"pullAll.d.ts",
"pullAllBy.d.ts",
"pullAllWith.d.ts",
"pullAt.d.ts",
"random.d.ts",
"range.d.ts",
@@ -261,6 +269,7 @@
"thru.d.ts",
"times.d.ts",
"toArray.d.ts",
"toFinite.d.ts",
"toInteger.d.ts",
"toLength.d.ts",
"toLower.d.ts",
@@ -284,12 +293,13 @@
"unionWith.d.ts",
"uniq.d.ts",
"uniqBy.d.ts",
"uniqWith.d.ts",
"uniqueId.d.ts",
"uniqWith.d.ts",
"unset.d.ts",
"unzip.d.ts",
"unzipWith.d.ts",
"update.d.ts",
"updateWith.d.ts",
"upperCase.d.ts",
"upperFirst.d.ts",
"values.d.ts",
@@ -302,6 +312,7 @@
"xorWith.d.ts",
"zip.d.ts",
"zipObject.d.ts",
"zipObjectDeep.d.ts",
"zipWith.d.ts"
]
}
+2
View File
@@ -0,0 +1,2 @@
import { updateWith } from "lodash";
export default updateWith;
+2
View File
@@ -0,0 +1,2 @@
import { zipObjectDeep } from "lodash";
export default zipObjectDeep;
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for lodash.cond 4.5
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>, Stepan Mikhaylyuk <https://github.com/stepancar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts
import { cond } from "lodash";
export = cond;
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for lodash.divide 4.9
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>, Stepan Mikhaylyuk <https://github.com/stepancar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts
import { divide } from "lodash";
export = divide;
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for lodash.flatMapDeep 4.10
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>, Stepan Mikhaylyuk <https://github.com/stepancar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts
import { flatMapDeep } from "lodash";
export = flatMapDeep;
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for lodash.flatMapDepth 4.10
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>, Stepan Mikhaylyuk <https://github.com/stepancar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts
import { flatMapDepth } from "lodash";
export = flatMapDepth;
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+3 -1
View File
@@ -1,8 +1,10 @@
// Type definitions for lodash.nth 4.0
// Type definitions for lodash.nth 4.11
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>, Stepan Mikhaylyuk <https://github.com/stepancar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts
import { nth } from "lodash";
export = nth;
+5 -5
View File
@@ -1,7 +1,4 @@
{
"files": [
"index.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
@@ -9,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -17,5 +14,8 @@
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
},
"files": [
"index.d.ts"
]
}
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for lodash.pullAllWith 4.7
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>, Stepan Mikhaylyuk <https://github.com/stepancar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts
import { pullAllWith } from "lodash";
export = pullAllWith;
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for lodash.toFinite 4.12
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>, Stepan Mikhaylyuk <https://github.com/stepancar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts
import { toFinite } from "lodash";
export = toFinite;
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for lodash.updateWith 4.10
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>, Stepan Mikhaylyuk <https://github.com/stepancar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts
import { updateWith } from "lodash";
export = updateWith;
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+3 -1
View File
@@ -1,8 +1,10 @@
// Type definitions for lodash.zipObjectDeep 4.1
// Type definitions for lodash.zipObjectDeep 4.4
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>, Stepan Mikhaylyuk <https://github.com/stepancar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts
import { zipObjectDeep } from "lodash";
export = zipObjectDeep;
+5 -5
View File
@@ -1,7 +1,4 @@
{
"files": [
"index.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
@@ -9,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -17,5 +14,8 @@
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
},
"files": [
"index.d.ts"
]
}
+2
View File
@@ -0,0 +1,2 @@
import { cond } from "./index";
export = cond;
+2
View File
@@ -0,0 +1,2 @@
import { divide } from "./index";
export = divide;
+2
View File
@@ -0,0 +1,2 @@
import { entries } from "./index";
export = entries;
+2
View File
@@ -0,0 +1,2 @@
import { entriesIn } from "./index";
export = entriesIn;
+2
View File
@@ -0,0 +1,2 @@
import { flatMapDeep } from "./index";
export = flatMapDeep;
+2
View File
@@ -0,0 +1,2 @@
import { flatMapDepth } from "./index";
export = flatMapDepth;
+596 -5
View File
@@ -5,9 +5,10 @@
// Stepan Mikhaylyuk <https://github.com/stepancar>,
// Eric L Anderson <https://github.com/ericanderson>,
// AJ Richardson <https://github.com/aj-r>,
// Junyoung Clare Jang <https://github.com/ailrun>
// Junyoung Clare Jang <https://github.com/ailrun>,
// e-cloud <https://github.com/e-cloud>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 2.4
/**
### 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog)
@@ -1958,6 +1959,7 @@ declare namespace _ {
}
interface RecursiveArray<T> extends Array<T|RecursiveArray<T>> {}
interface ListOfRecursiveArraysOrValues<T> extends List<T|RecursiveArray<T>> {}
//_.flatten
@@ -2088,7 +2090,7 @@ declare namespace _ {
* @return Returns the new flattened array.
*/
flattenDepth<T>(array: ListOfRecursiveArraysOrValues<T> | null | undefined, depth?: number): T[];
}
}
//_.fromPairs
interface LoDashStatic {
@@ -2430,6 +2432,40 @@ declare namespace _ {
): any[];
}
type Comparator<T> = (arrVal: T, othVal: T) => boolean;
//_.pullAllWith
interface LoDashStatic {
/**
* This method is like `_.pullAll` except that it accepts `comparator` which
* is invoked to compare elements of `array` to `values`. The comparator is
* invoked with two arguments: (arrVal, othVal).
*
* **Note:** Unlike `_.differenceWith`, this method mutates `array`.
*
* @static
* @memberOf _
* @since 4.6.0
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns `array`.
* @example
*
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
*
* _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
* console.log(array);
* // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
*/
pullAllWith<T>(
array: List<T>,
values: List<T>,
comparator?: Comparator<T>
): List<T>;
}
//_.reverse DUMMY
interface LoDashStatic {
/**
@@ -6789,7 +6825,7 @@ declare namespace _ {
predicate: ListIteratorTypeGuard<T, S>,
fromIndex?: number
): S|undefined;
/**
* @see _.find
*/
@@ -6880,7 +6916,7 @@ declare namespace _ {
predicate: ListIteratorTypeGuard<T, S>,
fromIndex?: number
): S|undefined;
/**
* @see _.findLast
*/
@@ -7138,6 +7174,411 @@ declare namespace _ {
flatMap<TResult>(): LoDashExplicitArrayWrapper<TResult>;
}
//_.flatMapDeep
interface LoDashStatic {
/**
* This method is like `_.flatMap` except that it recursively flattens the
* mapped results.
*
* @static
* @memberOf _
* @since 4.7.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new flattened array.
* @example
*
* function duplicate(n) {
* return [[[n, n]]];
* }
*
* _.flatMapDeep([1, 2], duplicate);
* // => [1, 1, 2, 2]
*/
flatMapDeep<T>(
collection: List<ListOfRecursiveArraysOrValues<T>> | Dictionary<ListOfRecursiveArraysOrValues<T>> | NumericDictionary<ListOfRecursiveArraysOrValues<T>> | null | undefined
): T[];
/**
* @see _.flatMapDeep
*/
flatMapDeep<T, TResult>(
collection: List<T> | null | undefined,
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult>> | string
): TResult[];
/**
* @see _.flatMapDeep
*/
flatMapDeep<T, TResult>(
collection: Dictionary<T> | null | undefined,
iteratee: DictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult>> | string
): TResult[];
/**
* @see _.flatMapDeep
*/
flatMapDeep<T, TResult>(
collection: NumericDictionary<T> | null | undefined,
iteratee: NumericDictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult>> | string
): TResult[];
/**
* @see _.flatMapDeep
*/
flatMapDeep<TResult>(
collection: object | null | undefined,
iteratee?: ObjectIterator<any, ListOfRecursiveArraysOrValues<TResult>> | string
): TResult[];
/**
* @see _.flatMapDeep
*/
flatMapDeep(
collection: object | null | undefined,
iteratee: object
): boolean[];
}
interface LoDashImplicitWrapper<T> {
/**
* @see _.flatMapDeep
*/
flatMapDeep<TResult>(
iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult>>
): LoDashImplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDeep
*/
flatMapDeep(): LoDashImplicitArrayWrapper<string>;
}
interface LoDashImplicitArrayWrapperBase<T, TArray extends T[] | null | undefined, TWrapper> {
/**
* @see _.flatMapDeep
*/
flatMapDeep<TResult>(
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult>>|string
): LoDashImplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDeep
*/
flatMapDeep(
iteratee: object
): LoDashImplicitArrayWrapper<boolean>;
/**
* @see _.flatMapDeep
*/
flatMapDeep<TResult>(): LoDashImplicitArrayWrapper<TResult>;
}
interface LoDashImplicitObjectWrapperBase<T, TObject extends T | null | undefined, TWrapper> {
/**
* @see _.flatMapDeep
*/
flatMapDeep<T, TResult>(
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult>>|DictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult>>|NumericDictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult>>
): LoDashImplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDeep
*/
flatMapDeep<TResult>(
iteratee: ObjectIterator<any, ListOfRecursiveArraysOrValues<TResult>>|string
): LoDashImplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDeep
*/
flatMapDeep(
iteratee: object
): LoDashImplicitArrayWrapper<boolean>;
/**
* @see _.flatMapDeep
*/
flatMapDeep<TResult>(): LoDashImplicitArrayWrapper<TResult>;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.flatMapDeep
*/
flatMapDeep<TResult>(
iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult>>
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDeep
*/
flatMapDeep(): LoDashExplicitArrayWrapper<string>;
}
interface LoDashExplicitArrayWrapperBase<T, TArray extends T[] | null | undefined, TWrapper> {
/**
* @see _.flatMapDeep
*/
flatMapDeep<TResult>(
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult>>|string
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDeep
*/
flatMapDeep(
iteratee: object
): LoDashExplicitArrayWrapper<boolean>;
/**
* @see _.flatMapDeep
*/
flatMapDeep<TResult>(): LoDashExplicitArrayWrapper<TResult>;
}
interface LoDashExplicitObjectWrapperBase<T, TObject extends T | null | undefined, TWrapper> {
/**
* @see _.flatMapDeep
*/
flatMapDeep<T, TResult>(
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult>>|DictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult>>|NumericDictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult>>
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDeep
*/
flatMapDeep<TResult>(
iteratee: ObjectIterator<any, ListOfRecursiveArraysOrValues<TResult>>|string
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDeep
*/
flatMapDeep(
iteratee: object
): LoDashExplicitArrayWrapper<boolean>;
/**
* @see _.flatMapDeep
*/
flatMapDeep<TResult>(): LoDashExplicitArrayWrapper<TResult>;
}
//_.flatMapDepth
interface LoDashStatic {
/**
* This method is like `_.flatMap` except that it recursively flattens the
* mapped results up to `depth` times.
*
* @static
* @memberOf _
* @since 4.7.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {number} [depth=1] The maximum recursion depth.
* @returns {Array} Returns the new flattened array.
* @example
*
* function duplicate(n) {
* return [[[n, n]]];
* }
*
* _.flatMapDepth([1, 2], duplicate, 2);
* // => [[1, 1], [2, 2]]
*/
flatMapDepth<T>(
collection: List<ListOfRecursiveArraysOrValues<T>> | Dictionary<ListOfRecursiveArraysOrValues<T>> | NumericDictionary<ListOfRecursiveArraysOrValues<T>> | null | undefined,
depth?: number
): T[];
/**
* @see _.flatMapDepth
*/
flatMapDepth<T, TResult>(
collection: List<T> | null | undefined,
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult>> | string,
depth?: number
): TResult[];
/**
* @see _.flatMapDepth
*/
flatMapDepth<T, TResult>(
collection: Dictionary<T> | null | undefined,
iteratee: DictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult>> | string,
depth?: number
): TResult[];
/**
* @see _.flatMapDepth
*/
flatMapDepth<T, TResult>(
collection: NumericDictionary<T> | null | undefined,
iteratee: NumericDictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult>> | string,
depth?: number
): TResult[];
/**
* @see _.flatMapDepth
*/
flatMapDepth<TResult>(
collection: object | null | undefined,
iteratee?: ObjectIterator<any, ListOfRecursiveArraysOrValues<TResult>> | string,
depth?: number
): TResult[];
/**
* @see _.flatMapDepth
*/
flatMapDepth(
collection: object | null | undefined,
iteratee: object,
depth?: number
): boolean[];
}
interface LoDashImplicitWrapper<T> {
/**
* @see _.flatMapDepth
*/
flatMapDepth<TResult>(
iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult>>,
depth?: number
): LoDashImplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDepth
*/
flatMapDepth(): LoDashImplicitArrayWrapper<string>;
}
interface LoDashImplicitArrayWrapperBase<T, TArray extends T[] | null | undefined, TWrapper> {
/**
* @see _.flatMapDepth
*/
flatMapDepth<TResult>(
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult>>|string,
depth?: number
): LoDashImplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDepth
*/
flatMapDepth(
iteratee: object,
depth?: number
): LoDashImplicitArrayWrapper<boolean>;
/**
* @see _.flatMapDepth
*/
flatMapDepth<TResult>(): LoDashImplicitArrayWrapper<TResult>;
}
interface LoDashImplicitObjectWrapperBase<T, TObject extends T | null | undefined, TWrapper> {
/**
* @see _.flatMapDepth
*/
flatMapDepth<T, TResult>(
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult>>|DictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult>>|NumericDictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult>>,
depth?: number
): LoDashImplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDepth
*/
flatMapDepth<TResult>(
iteratee: ObjectIterator<any, ListOfRecursiveArraysOrValues<TResult>>|string,
depth?: number
): LoDashImplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDepth
*/
flatMapDepth(
iteratee: object,
depth?: number
): LoDashImplicitArrayWrapper<boolean>;
/**
* @see _.flatMapDepth
*/
flatMapDepth<TResult>(): LoDashImplicitArrayWrapper<TResult>;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.flatMapDepth
*/
flatMapDepth<TResult>(
iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult>>,
depth?: number
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDepth
*/
flatMapDepth(): LoDashExplicitArrayWrapper<string>;
}
interface LoDashExplicitArrayWrapperBase<T, TArray extends T[] | null | undefined, TWrapper> {
/**
* @see _.flatMapDepth
*/
flatMapDepth<TResult>(
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult>>|string,
depth?: number
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDepth
*/
flatMapDepth(
iteratee: object,
depth?: number
): LoDashExplicitArrayWrapper<boolean>;
/**
* @see _.flatMapDepth
*/
flatMapDepth<TResult>(): LoDashExplicitArrayWrapper<TResult>;
}
interface LoDashExplicitObjectWrapperBase<T, TObject extends T | null | undefined, TWrapper> {
/**
* @see _.flatMapDepth
*/
flatMapDepth<T, TResult>(
iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult>>|DictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult>>|NumericDictionaryIterator<T, ListOfRecursiveArraysOrValues<TResult>>,
depth?: number
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDepth
*/
flatMapDepth<TResult>(
iteratee: ObjectIterator<any, ListOfRecursiveArraysOrValues<TResult>>|string,
depth?: number
): LoDashExplicitArrayWrapper<TResult>;
/**
* @see _.flatMapDepth
*/
flatMapDepth(
iteratee: object,
depth?: number
): LoDashExplicitArrayWrapper<boolean>;
/**
* @see _.flatMapDepth
*/
flatMapDepth<TResult>(): LoDashExplicitArrayWrapper<TResult>;
}
//_.forEach
interface LoDashStatic {
/**
@@ -11351,6 +11792,42 @@ declare namespace _ {
conformsTo<T>(object: T, source: ConformsPredicateObject<T>): boolean;
}
type CondPair<T, R> = [(val: T) => boolean, (val: T) => R]
//_.cond
interface LoDashStatic {
/**
* Creates a function that iterates over `pairs` and invokes the corresponding
* function of the first predicate to return truthy. The predicate-function
* pairs are invoked with the `this` binding and arguments of the created
* function.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Util
* @param {Array} pairs The predicate-function pairs.
* @returns {Function} Returns the new composite function.
* @example
*
* var func = _.cond([
* [_.matches({ 'a': 1 }), _.constant('matches A')],
* [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
* [_.stubTrue, _.constant('no match')]
* ]);
*
* func({ 'a': 1, 'b': 2 });
* // => 'matches A'
*
* func({ 'a': 0, 'b': 1 });
* // => 'matches B'
*
* func({ 'a': '1', 'b': '2' });
* // => 'no match'
*/
cond<T, R>(pairs: CondPair<T, R>[]): (Target: T) => R;
}
//_.eq
interface LoDashStatic {
/**
@@ -14861,6 +15338,54 @@ declare namespace _ {
defaultsDeep<TResult>(...sources: any[]): LoDashImplicitObjectWrapper<TResult>;
}
//_.entries
interface LoDashStatic {
/**
* @see _.toPairs
*/
entries<T extends {}>(object?: T): [string, any][];
entries<T extends {}, TResult>(object?: T): [string, TResult][];
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.toPairs
*/
entries<TResult>(): LoDashImplicitArrayWrapper<[string, TResult]>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.toPairs
*/
entries<TResult>(): LoDashExplicitArrayWrapper<[string, TResult]>;
}
//_.entriesIn
interface LoDashStatic {
/**
* @see _.toPairsIn
*/
entriesIn<T extends {}>(object?: T): [string, any][];
entriesIn<T extends {}, TResult>(object?: T): [string, TResult][];
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.toPairsIn
*/
entriesIn<TResult>(): LoDashImplicitArrayWrapper<[string, TResult]>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.toPairsIn
*/
entriesIn<TResult>(): LoDashExplicitArrayWrapper<[string, TResult]>;
}
// _.extend
interface LoDashStatic {
/**
@@ -17231,6 +17756,72 @@ declare namespace _ {
): LoDashExplicitObjectWrapper<TResult>;
}
//_.updateWith
interface LoDashStatic {
/**
* This method is like `_.update` except that it accepts `customizer` which is
* invoked to produce the objects of `path`. If `customizer` returns `undefined`
* path creation is handled by the method instead. The `customizer` is invoked
* with three arguments: (nsValue, key, nsObject).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.6.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {Function} updater The function to produce the updated value.
* @param {Function} [customizer] The function to customize assigned values.
* @returns {Object} Returns `object`.
* @example
*
* var object = {};
*
* _.updateWith(object, '[0][1]', _.constant('a'), Object);
* // => { '0': { '1': 'a' } }
*/
updateWith<TResult>(
object: Object,
path: Many<StringRepresentable>,
updater: (oldValue: any) => any,
customizer?: SetWithCustomizer<Object>
): TResult;
/**
* @see _.updateWith
*/
updateWith<O extends {}, TResult>(
object: O,
path: Many<StringRepresentable>,
updater: (oldValue: any) => any,
customizer?: SetWithCustomizer<O>
): TResult;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.updateWith
*/
updateWith<TResult>(
path: Many<StringRepresentable>,
updater: (oldValue: any) => any,
customizer?: SetWithCustomizer<T>
): LoDashImplicitObjectWrapper<TResult>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.updateWith
*/
updateWith<TResult>(
path: Many<StringRepresentable>,
updater: (oldValue: any) => any,
customizer?: SetWithCustomizer<T>
): LoDashExplicitObjectWrapper<TResult>;
}
//_.values
interface LoDashStatic {
/**
+463 -1
View File
@@ -4198,6 +4198,330 @@ namespace TestFlatMap {
}
}
// _.flatMapDeep
namespace TestFlatMapDeep {
let numArray: (number|number[])[] | null | undefined = [1, [2, 3]] as any;
let objArray: ({a: number}|{a: number}[])[] | null | undefined = [{a: 1}, [{a: 2}, {a: 3}]] as any;
let obj: any = {};
let numList: _.List<number|number[]> | null | undefined = obj;
let objList: _.List<{a: number}|{a: number}[]> | null | undefined = obj;
let numDictionary: _.Dictionary<number|number[]> | null | undefined = obj;
let objDictionary: _.Dictionary<{a: number}|{a: number}[]> | null | undefined = obj;
let numNumericDictionary: _.NumericDictionary<number|number[]> | null | undefined = obj;
let objNumericDictionary: _.NumericDictionary<{a: number}|{a: number}[]> | null | undefined = obj;
let stringIterator: (value: string, index: number, collection: _.List<string>) => _.ListOfRecursiveArraysOrValues<string> = (a, b, c) => ['a', 'b', 'c'];
let listIterator: (value: number|number[], index: number, collection: _.List<number|number[]>) => _.ListOfRecursiveArraysOrValues<number> = (a, b, c) => [1];
let dictionaryIterator: (value: number|number[], key: string, collection: _.Dictionary<number|number[]>) =>_.ListOfRecursiveArraysOrValues<number> = (a, b, c) => [1];
let numericDictionaryIterator: (value: number|number[], key: number, collection: _.NumericDictionary<number|number[]>) => _.ListOfRecursiveArraysOrValues<number> = (a, b, c) => [1];
{
let result: string[];
result = _.flatMapDeep('abc');
result = _.flatMapDeep('abc', stringIterator);
}
{
let result: number[];
result = _.flatMapDeep(numArray);
result = _.flatMapDeep(numArray, listIterator);
result = _.flatMapDeep(objArray, 'a');
result = _.flatMapDeep(numList);
result = _.flatMapDeep(numList, listIterator);
result = _.flatMapDeep(objList, 'a');
result = _.flatMapDeep(numDictionary);
result = _.flatMapDeep(numDictionary, dictionaryIterator);
result = _.flatMapDeep(objDictionary, 'a');
result = _.flatMapDeep(numNumericDictionary);
result = _.flatMapDeep(numNumericDictionary, numericDictionaryIterator);
result = _.flatMapDeep(objNumericDictionary, 'a');
}
{
let result: boolean[];
result = _.flatMapDeep(objArray, ['a', 42]);
result = _.flatMapDeep(objArray, {'a': 42});
result = _.flatMapDeep(objList, ['a', 42]);
result = _.flatMapDeep(objList, {'a': 42});
result = _.flatMapDeep(objDictionary, ['a', 42]);
result = _.flatMapDeep(objDictionary, {'a': 42});
result = _.flatMapDeep(objNumericDictionary, ['a', 42]);
result = _.flatMapDeep(objNumericDictionary, {'a': 42});
}
{
let result: _.LoDashImplicitArrayWrapper<string>;
result = _('abc').flatMapDeep();
result = _('abc').flatMapDeep(stringIterator);
}
{
let result: _.LoDashImplicitArrayWrapper<number>;
result = _(numArray).flatMapDeep();
result = _(numArray).flatMapDeep(listIterator);
result = _(objArray).flatMapDeep('a');
result = _(numList).flatMapDeep();
result = _(numList).flatMapDeep(listIterator);
result = _(objList).flatMapDeep('a');
result = _(numDictionary).flatMapDeep();
result = _(numDictionary).flatMapDeep(dictionaryIterator);
result = _(objDictionary).flatMapDeep('a');
result = _(numNumericDictionary).flatMapDeep();
result = _(numNumericDictionary).flatMapDeep(numericDictionaryIterator);
result = _(objNumericDictionary).flatMapDeep('a');
}
{
let result: _.LoDashImplicitArrayWrapper<boolean>;
result = _(objArray).flatMapDeep(['a', 42]);
result = _(objArray).flatMapDeep({a: 42});
result = _(objList).flatMapDeep(['a', 42]);
result = _(objList).flatMapDeep({a: 42});
result = _(objDictionary).flatMapDeep(['a', 42]);
result = _(objDictionary).flatMapDeep({a: 42});
result = _(objNumericDictionary).flatMapDeep(['a', 42]);
result = _(objNumericDictionary).flatMapDeep({a: 42});
}
{
let result: _.LoDashExplicitArrayWrapper<string>;
result = _('abc').chain().flatMapDeep();
result = _('abc').chain().flatMapDeep(stringIterator);
}
{
let result: _.LoDashExplicitArrayWrapper<number>;
result = _(numArray).chain().flatMapDeep();
result = _(numArray).chain().flatMapDeep(listIterator);
result = _(objArray).chain().flatMapDeep('a');
result = _(numList).chain().flatMapDeep();
result = _(numList).chain().flatMapDeep(listIterator);
result = _(objList).chain().flatMapDeep('a');
result = _(numDictionary).chain().flatMapDeep();
result = _(numDictionary).chain().flatMapDeep(dictionaryIterator);
result = _(objDictionary).chain().flatMapDeep('a');
result = _(numNumericDictionary).chain().flatMapDeep();
result = _(numNumericDictionary).chain().flatMapDeep(numericDictionaryIterator);
result = _(objNumericDictionary).chain().flatMapDeep('a');
}
{
let result: _.LoDashExplicitArrayWrapper<boolean>;
result = _(objArray).chain().flatMapDeep(['a', 42]);
result = _(objArray).chain().flatMapDeep({a: 42});
result = _(objList).chain().flatMapDeep(['a', 42]);
result = _(objList).chain().flatMapDeep({a: 42});
result = _(objDictionary).chain().flatMapDeep(['a', 42]);
result = _(objDictionary).chain().flatMapDeep({a: 42});
result = _(objNumericDictionary).chain().flatMapDeep(['a', 42]);
result = _(objNumericDictionary).chain().flatMapDeep({a: 42});
}
}
// _.flatMapDepth
namespace TestFlatMapDepth {
let numArray: (number|number[])[] | null | undefined = [1, [2, 3]] as any;
let objArray: ({a: number}|{a: number}[])[] | null | undefined = [{a: 1}, [{a: 2}, {a: 3}]] as any;
let obj: any = {};
let numList: _.List<number|number[]> | null | undefined = obj;
let objList: _.List<{a: number}|{a: number}[]> | null | undefined = obj;
let numDictionary: _.Dictionary<number|number[]> | null | undefined = obj;
let objDictionary: _.Dictionary<{a: number}|{a: number}[]> | null | undefined = obj;
let numNumericDictionary: _.NumericDictionary<number|number[]> | null | undefined = obj;
let objNumericDictionary: _.NumericDictionary<{a: number}|{a: number}[]> | null | undefined = obj;
let stringIterator: (value: string, index: number, collection: _.List<string>) => _.ListOfRecursiveArraysOrValues<string> = (a, b, c) => "";
let listIterator: (value: number|number[], index: number, collection: _.List<number|number[]>) => _.ListOfRecursiveArraysOrValues<number> = (a, b, c) =>[ 1];
let dictionaryIterator: (value: number|number[], key: number, collection: _.Dictionary<number|number[]>) => _.ListOfRecursiveArraysOrValues<number> = (a, b, c) => [1];
let numericDictionaryIterator: (value: number|number[], key: number, collection: _.NumericDictionary<number|number[]>) => _.ListOfRecursiveArraysOrValues<number> = (a, b, c) => [1];
{
let result: string[];
result = _.flatMapDepth('abc');
result = _.flatMapDepth('abc', stringIterator, 1);
}
{
let result: number[];
result = _.flatMapDepth(numArray);
result = _.flatMapDepth(numArray, listIterator, 1);
result = _.flatMapDepth(objArray, 'a');
result = _.flatMapDepth(numList);
result = _.flatMapDepth(numList, listIterator, 1);
result = _.flatMapDepth(objList, 'a', 1);
result = _.flatMapDepth(numDictionary);
result = _.flatMapDepth(numDictionary, dictionaryIterator, 1);
result = _.flatMapDepth(objDictionary, 'a', 1);
result = _.flatMapDepth(numNumericDictionary);
result = _.flatMapDepth(numNumericDictionary, numericDictionaryIterator, 1);
result = _.flatMapDepth(objNumericDictionary, 'a', 1);
}
{
let result: boolean[];
result = _.flatMapDepth(objArray, ['a', 42], 1);
result = _.flatMapDepth(objArray, {'a': 42}, 1);
result = _.flatMapDepth(objList, ['a', 42], 1);
result = _.flatMapDepth(objList, {'a': 42}, 1);
result = _.flatMapDepth(objDictionary, ['a', 42], 1);
result = _.flatMapDepth(objDictionary, {'a': 42}, 1);
result = _.flatMapDepth(objNumericDictionary, ['a', 42], 1);
result = _.flatMapDepth(objNumericDictionary, {'a': 42}, 1);
}
{
let result: _.LoDashImplicitArrayWrapper<string>;
result = _('abc').flatMapDepth();
result = _('abc').flatMapDepth(stringIterator, 1);
}
{
let result: _.LoDashImplicitArrayWrapper<number>;
result = _(numArray).flatMapDepth();
result = _(numArray).flatMapDepth(listIterator, 1);
result = _(objArray).flatMapDepth('a', 1);
result = _(numList).flatMapDepth();
result = _(numList).flatMapDepth(listIterator, 1);
result = _(objList).flatMapDepth('a', 1);
result = _(numDictionary).flatMapDepth();
result = _(numDictionary).flatMapDepth(dictionaryIterator, 1);
result = _(objDictionary).flatMapDepth('a', 1);
result = _(numNumericDictionary).flatMapDepth();
result = _(numNumericDictionary).flatMapDepth(numericDictionaryIterator, 1);
result = _(objNumericDictionary).flatMapDepth('a', 1);
}
{
let result: _.LoDashImplicitArrayWrapper<boolean>;
result = _(objArray).flatMapDepth(['a', 42], 1);
result = _(objArray).flatMapDepth({a: 42}, 1);
result = _(objList).flatMapDepth(['a', 42], 1);
result = _(objList).flatMapDepth({a: 42}, 1);
result = _(objDictionary).flatMapDepth(['a', 42], 1);
result = _(objDictionary).flatMapDepth({a: 42}, 1);
result = _(objNumericDictionary).flatMapDepth(['a', 42], 1);
result = _(objNumericDictionary).flatMapDepth({a: 42}, 1);
}
{
let result: _.LoDashExplicitArrayWrapper<string>;
result = _('abc').chain().flatMapDepth();
result = _('abc').chain().flatMapDepth(stringIterator, 1);
}
{
let result: _.LoDashExplicitArrayWrapper<number>;
result = _(numArray).chain().flatMapDepth();
result = _(numArray).chain().flatMapDepth(listIterator, 1);
result = _(objArray).chain().flatMapDepth('a', 1);
result = _(numList).chain().flatMapDepth();
result = _(numList).chain().flatMapDepth(listIterator, 1);
result = _(objList).chain().flatMapDepth('a', 1);
result = _(numDictionary).chain().flatMapDepth();
result = _(numDictionary).chain().flatMapDepth(dictionaryIterator, 1);
result = _(objDictionary).chain().flatMapDepth('a', 1);
result = _(numNumericDictionary).chain().flatMapDepth();
result = _(numNumericDictionary).chain().flatMapDepth(numericDictionaryIterator, 1);
result = _(objNumericDictionary).chain().flatMapDepth('a', 1);
}
{
let result: _.LoDashExplicitArrayWrapper<boolean>;
result = _(objArray).chain().flatMapDepth(['a', 42], 1);
result = _(objArray).chain().flatMapDepth({a: 42}, 1);
result = _(objList).chain().flatMapDepth(['a', 42], 1);
result = _(objList).chain().flatMapDepth({a: 42}, 1);
result = _(objDictionary).chain().flatMapDepth(['a', 42], 1);
result = _(objDictionary).chain().flatMapDepth({a: 42}, 1);
result = _(objNumericDictionary).chain().flatMapDepth(['a', 42], 1);
result = _(objNumericDictionary).chain().flatMapDepth({a: 42}, 1);
}
}
// _.forEach
namespace TestForEach {
let array: TResult[] = [];
@@ -9406,6 +9730,88 @@ const TestDefaultsDeepSource = { 'user': { 'name': 'fred', 'age': 36 } };
result = <DefaultsDeepResult>_.defaultsDeep(TestDefaultsDeepObject, TestDefaultsDeepSource);
result = <DefaultsDeepResult>_(TestDefaultsDeepObject).defaultsDeep<DefaultsDeepResult>(TestDefaultsDeepSource).value();
// _.entries
namespace TestEntries {
let object: _.Dictionary<string> = {};
{
let result: [string, any][];
result = _.entries<_.Dictionary<string>>(object);
}
{
let result: [string, string][];
result = _.entries<_.Dictionary<string>, string>(object);
}
{
let result: _.LoDashImplicitArrayWrapper<[string, string]>;
result = _(object).entries<string>();
}
{
let result: _.LoDashImplicitArrayWrapper<[string, any]>;
result = _(object).entries();
}
{
let result: _.LoDashExplicitArrayWrapper<[string, string]>;
result = _(object).chain().entries<string>();
}
{
let result: _.LoDashExplicitArrayWrapper<[string, any]>;
result = _(object).chain().entries();
}
}
// _.entriesIn
namespace TestEntriesIn {
let object: _.Dictionary<string> = {};
{
let result: [string, any][];
result = _.entriesIn<_.Dictionary<string>>(object);
}
{
let result: [string, string][];
result = _.entriesIn<_.Dictionary<string>, string>(object);
}
{
let result: _.LoDashImplicitArrayWrapper<[string, string]>;
result = _(object).entriesIn<string>();
}
{
let result: _.LoDashImplicitArrayWrapper<[string, any]>;
result = _(object).entriesIn();
}
{
let result: _.LoDashExplicitArrayWrapper<[string, string]>;
result = _(object).chain().entriesIn<string>();
}
{
let result: _.LoDashExplicitArrayWrapper<[string, any]>;
result = _(object).chain().entriesIn();
}
}
// _.extend
namespace TestExtend {
type Obj = { a: string };
@@ -11002,7 +11408,7 @@ namespace TestToPairsIn {
{
let result: _.LoDashExplicitArrayWrapper<[string, any]>;
result = _(object).chain().toPairs();
result = _(object).chain().toPairsIn();
}
}
@@ -11137,6 +11543,48 @@ namespace TestUpdate {
}
}
// _.updateWith
namespace TestUpdateWith {
type SampleObject = {a: {}};
type SampleResult = {a: {b: number[]}};
let object: SampleObject = { a: {} };
let updater = (value: any) => 0;
let customizer = (value: any, key: string, object: SampleObject) => 0;
{
let result: SampleResult;
result = _.updateWith<SampleResult>(object, 'a.b[1]', updater);
result = _.updateWith<SampleResult>(object, 'a.b[1]', updater, customizer);
result = _.updateWith<SampleResult>(object, ['a', 'b', 1], updater);
result = _.updateWith<SampleResult>(object, ['a', 'b', 1], updater, customizer);
result = _.updateWith<SampleResult>(object, 'a.b[1]', updater);
result = _.updateWith<SampleResult>(object, 'a.b[1]', updater, customizer);
result = _.updateWith<SampleResult>(object, ['a', 'b', 1], updater);
result = _.updateWith<SampleResult>(object, ['a', 'b', 1], updater, customizer);
}
{
let result: _.LoDashImplicitObjectWrapper<SampleResult>;
result = _(object).updateWith<SampleResult>('a.b[1]', updater);
result = _(object).updateWith<SampleResult>('a.b[1]', updater, customizer);
result = _(object).updateWith<SampleResult>(['a', 'b', 1], updater);
result = _(object).updateWith<SampleResult>(['a', 'b', 1], updater, customizer);
}
{
let result: _.LoDashExplicitObjectWrapper<SampleResult>;
result = _(object).chain().updateWith<SampleResult>('a.b[1]', updater);
result = _(object).chain().updateWith<SampleResult>('a.b[1]', updater, customizer);
result = _(object).chain().updateWith<SampleResult>(['a', 'b', 1], updater);
result = _(object).chain().updateWith<SampleResult>(['a', 'b', 1], updater, customizer);
}
}
// _.values
namespace TestValues {
type SampleObject = {a: {}};
@@ -11945,6 +12393,20 @@ namespace TestAttempt {
}
}
// _.cond
namespace TestCond {
let pairPred1: (val: string) => boolean = (val) => true;
let pairPred2: (val: string) => boolean = (val) => false;
let pairRes1: (val: string) => number = (val) => 1;
let pairRes2: (val: string) => number = (val) => 2;
{
let result: number;
result = _.cond([[pairPred1, pairRes1],[pairPred2, pairRes2]])('hello');
}
}
// _.constant
namespace TestConstant {
{
+2
View File
@@ -0,0 +1,2 @@
import { nth } from "./index";
export = nth;
+2
View File
@@ -0,0 +1,2 @@
import { pullAllWith } from "./index";
export = pullAllWith;
+15 -2
View File
@@ -160,6 +160,8 @@ function modulesNotOnNpm(): string[] {
"chain",
"each",
"eachRight",
"entries",
"entriesIn",
"extend",
"extendWith",
"noConflict",
@@ -199,6 +201,7 @@ function allModuleNames(): string[] {
"cloneWith",
"compact",
"concat",
"cond",
"constant",
"countBy",
"create",
@@ -213,6 +216,7 @@ function allModuleNames(): string[] {
"difference",
"differenceBy",
"differenceWith",
"divide",
"drop",
"dropRight",
"dropRightWhile",
@@ -220,6 +224,8 @@ function allModuleNames(): string[] {
"each",
"eachRight",
"endsWith",
"entries",
"entriesIn",
"eq",
"escape",
"escapeRegExp",
@@ -236,6 +242,8 @@ function allModuleNames(): string[] {
"findLastKey",
"first",
"flatMap",
"flatMapDeep",
"flatMapDepth",
"flatten",
"flattenDeep",
"flattenDepth",
@@ -260,10 +268,10 @@ function allModuleNames(): string[] {
"hasIn",
"head",
"identity",
"inRange",
"includes",
"indexOf",
"initial",
"inRange",
"intersection",
"intersectionBy",
"intersectionWith",
@@ -341,6 +349,7 @@ function allModuleNames(): string[] {
"noConflict",
"noop",
"now",
"nth",
"nthArg",
"omit",
"omitBy",
@@ -364,6 +373,7 @@ function allModuleNames(): string[] {
"pull",
"pullAll",
"pullAllBy",
"pullAllWith",
"pullAt",
"random",
"range",
@@ -416,6 +426,7 @@ function allModuleNames(): string[] {
"thru",
"times",
"toArray",
"toFinite",
"toInteger",
"toLength",
"toLower",
@@ -439,12 +450,13 @@ function allModuleNames(): string[] {
"unionWith",
"uniq",
"uniqBy",
"uniqWith",
"uniqueId",
"uniqWith",
"unset",
"unzip",
"unzipWith",
"update",
"updateWith",
"upperCase",
"upperFirst",
"values",
@@ -457,6 +469,7 @@ function allModuleNames(): string[] {
"xorWith",
"zip",
"zipObject",
"zipObjectDeep",
"zipWith"
];
}
+2
View File
@@ -0,0 +1,2 @@
import { toFinite } from "./index";
export = toFinite;
+13 -2
View File
@@ -44,6 +44,7 @@
"cloneWith.d.ts",
"compact.d.ts",
"concat.d.ts",
"cond.d.ts",
"constant.d.ts",
"countBy.d.ts",
"create.d.ts",
@@ -58,6 +59,7 @@
"difference.d.ts",
"differenceBy.d.ts",
"differenceWith.d.ts",
"divide.d.ts",
"drop.d.ts",
"dropRight.d.ts",
"dropRightWhile.d.ts",
@@ -65,6 +67,8 @@
"each.d.ts",
"eachRight.d.ts",
"endsWith.d.ts",
"entries.d.ts",
"entriesIn.d.ts",
"eq.d.ts",
"escape.d.ts",
"escapeRegExp.d.ts",
@@ -81,6 +85,8 @@
"findLastKey.d.ts",
"first.d.ts",
"flatMap.d.ts",
"flatMapDeep.d.ts",
"flatMapDepth.d.ts",
"flatten.d.ts",
"flattenDeep.d.ts",
"flattenDepth.d.ts",
@@ -105,10 +111,10 @@
"hasIn.d.ts",
"head.d.ts",
"identity.d.ts",
"inRange.d.ts",
"includes.d.ts",
"indexOf.d.ts",
"initial.d.ts",
"inRange.d.ts",
"intersection.d.ts",
"intersectionBy.d.ts",
"intersectionWith.d.ts",
@@ -186,6 +192,7 @@
"noConflict.d.ts",
"noop.d.ts",
"now.d.ts",
"nth.d.ts",
"nthArg.d.ts",
"omit.d.ts",
"omitBy.d.ts",
@@ -209,6 +216,7 @@
"pull.d.ts",
"pullAll.d.ts",
"pullAllBy.d.ts",
"pullAllWith.d.ts",
"pullAt.d.ts",
"random.d.ts",
"range.d.ts",
@@ -261,6 +269,7 @@
"thru.d.ts",
"times.d.ts",
"toArray.d.ts",
"toFinite.d.ts",
"toInteger.d.ts",
"toLength.d.ts",
"toLower.d.ts",
@@ -284,12 +293,13 @@
"unionWith.d.ts",
"uniq.d.ts",
"uniqBy.d.ts",
"uniqWith.d.ts",
"uniqueId.d.ts",
"uniqWith.d.ts",
"unset.d.ts",
"unzip.d.ts",
"unzipWith.d.ts",
"update.d.ts",
"updateWith.d.ts",
"upperCase.d.ts",
"upperFirst.d.ts",
"values.d.ts",
@@ -302,6 +312,7 @@
"xorWith.d.ts",
"zip.d.ts",
"zipObject.d.ts",
"zipObjectDeep.d.ts",
"zipWith.d.ts"
]
}
+2
View File
@@ -0,0 +1,2 @@
import { updateWith } from "./index";
export = updateWith;
+2
View File
@@ -0,0 +1,2 @@
import { zipObjectDeep } from "./index";
export = zipObjectDeep;