@types/lodash
Version:
TypeScript definitions for Lo-Dash
1,486 lines (1,342 loc) • 586 kB
TypeScript
// Type definitions for Lo-Dash 4.14
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>,
// Ilya Mochalov <https://github.com/chrootsu>,
// 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>,
// e-cloud <https://github.com/e-cloud>,
// Georgii Dolzhykov <https://github.com/thorn0>,
// Jack Moore <https://github.com/jtmthf>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/**
### 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog)
#### TODO:
removed:
- [x] Removed _.support
- [x] Removed _.findWhere in favor of _.find with iteratee shorthand
- [x] Removed _.where in favor of _.filter with iteratee shorthand
- [x] Removed _.pluck in favor of _.map with iteratee shorthand
renamed:
- [x] Renamed _.first to _.head
- [x] Renamed _.indexBy to _.keyBy
- [x] Renamed _.invoke to _.invokeMap
- [x] Renamed _.overArgs to _.overArgs
- [x] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd
- [x] Renamed _.pairs to _.toPairs
- [x] Renamed _.rest to _.tail
- [x] Renamed _.restParam to _.rest
- [x] Renamed _.sortByOrder to _.orderBy
- [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd
- [x] Renamed _.trunc to _.truncate
split:
- [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf
- [x] Split _.max & _.min into _.maxBy & _.minBy
- [x] Split _.omit & _.pick into _.omitBy & _.pickBy
- [x] Split _.sample into _.sampleSize
- [x] Split _.sortedIndex into _.sortedIndexBy
- [x] Split _.sortedLastIndex into _.sortedLastIndexBy
- [x] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy
changes:
- [x] Absorbed _.sortByAll into _.sortBy
- [x] Changed the category of _.at to “Object”
- [x] Changed the category of _.bindAll to “Utility”
- [x] Made _.capitalize uppercase the first character & lowercase the rest
- [x] Made _.functions return only own method names
added 23 array methods:
- [x] _.concat
- [x] _.differenceBy
- [x] _.differenceWith
- [x] _.flatMap
- [x] _.fromPairs
- [x] _.intersectionBy
- [x] _.intersectionWith
- [x] _.join
- [x] _.pullAll
- [x] _.pullAllBy
- [x] _.reverse
- [x] _.sortedIndexBy
- [x] _.sortedIndexOf
- [x] _.sortedLastIndexBy
- [x] _.sortedLastIndexOf
- [x] _.sortedUniq
- [x] _.sortedUniqBy
- [x] _.unionBy
- [x] _.unionWith
- [x] _.uniqBy
- [x] _.uniqWith
- [x] _.xorBy
- [x] _.xorWith
added 20 lang methods:
- [x] _.cloneDeepWith
- [x] _.cloneWith
- [x] _.eq
- [x] _.isArrayLike
- [x] _.isArrayLikeObject
- [x] _.isEqualWith
- [x] _.isInteger
- [x] _.isLength
- [x] _.isMatchWith
- [x] _.isNil
- [x] _.isObjectLike
- [x] _.isSafeInteger
- [x] _.isSymbol
- [x] _.toInteger
- [x] _.toLength
- [x] _.toNumber
- [x] _.toSafeInteger
- [x] _.toString
- [X] _.conforms
- [X] _.conformsTo
added 13 object methods:
- [x] _.assignIn
- [x] _.assignInWith
- [x] _.assignWith
- [x] _.functionsIn
- [x] _.hasIn
- [x] _.mergeWith
- [x] _.omitBy
- [x] _.pickBy
added 8 string methods:
- [x] _.lowerCase
- [x] _.lowerFirst
- [x] _.upperCase
- [x] _.upperFirst
- [x] _.toLower
- [x] _.toUpper
added 8 utility methods:
- [x] _.toPath
added 4 math methods:
- [x] _.maxBy
- [x] _.mean
- [x] _.minBy
- [x] _.sumBy
added 2 function methods:
- [x] _.flip
- [x] _.unary
added 2 number methods:
- [x] _.clamp
- [x] _.subtract
added collection method:
- [x] _.sampleSize
Added 3 aliases
- [x] _.first as an alias of _.head
Removed 17 aliases
- [x] Removed aliase _.all
- [x] Removed aliase _.any
- [x] Removed aliase _.backflow
- [x] Removed aliase _.callback
- [x] Removed aliase _.collect
- [x] Removed aliase _.compose
- [x] Removed aliase _.contains
- [x] Removed aliase _.detect
- [x] Removed aliase _.foldl
- [x] Removed aliase _.foldr
- [x] Removed aliase _.include
- [x] Removed aliase _.inject
- [x] Removed aliase _.methods
- [x] Removed aliase _.object
- [x] Removed aliase _.run
- [x] Removed aliase _.select
- [x] Removed aliase _.unique
Other changes
- [x] Added support for array buffers to _.isEqual
- [x] Added support for converting iterators to _.toArray
- [x] Added support for deep paths to _.zipObject
- [x] Changed UMD to export to window or self when available regardless of other exports
- [x] Ensured debounce cancel clears args & thisArg references
- [x] Ensured _.add, _.subtract, & _.sum don’t skip NaN values
- [x] Ensured _.clone treats generators like functions
- [x] Ensured _.clone produces clones with the source’s [[Prototype]]
- [x] Ensured _.defaults assigns properties that shadow Object.prototype
- [x] Ensured _.defaultsDeep doesn’t merge a string into an array
- [x] Ensured _.defaultsDeep & _.merge don’t modify sources
- [x] Ensured _.defaultsDeep works with circular references
- [x] Ensured _.keys skips “length” on strict mode arguments objects in Safari 9
- [x] Ensured _.merge doesn’t convert strings to arrays
- [x] Ensured _.merge merges plain-objects onto non plain-objects
- [x] Ensured _#plant resets iterator data of cloned sequences
- [x] Ensured _.random swaps min & max if min is greater than max
- [x] Ensured _.range preserves the sign of start of -0
- [x] Ensured _.reduce & _.reduceRight use getIteratee in their array branch
- [x] Fixed rounding issue with the precision param of _.floor
- [x] Added flush method to debounced & throttled functions
** LATER **
Misc:
- [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence
- [ ] Removed thisArg params from most methods
- [ ] Made “By” methods provide a single param to iteratees
- [ ] Made _.words chainable by default
- [ ] Removed isDeep params from _.clone & _.flatten
- [ ] Removed _.bindAll support for binding all methods when no names are provided
- [ ] Removed func-first param signature from _.before & _.after
- [ ] _.extend as an alias of _.assignIn
- [ ] _.extendWith as an alias of _.assignInWith
- [ ] Added clear method to _.memoize.Cache
- [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray
- [x] Enabled _.flow & _.flowRight to accept an array of functions
- [ ] Ensured “Collection” methods treat functions as objects
- [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects
- [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator
- [ ] Ensured _.isFunction returns true for generator functions
- [ ] Ensured _.merge assigns typed arrays directly
- [ ] Made _(...) an iterator & iterable
- [ ] Made _.drop, _.take, & right forms coerce n of undefined to 0
Methods:
- [ ] _.concat
- [ ] _.differenceBy
- [ ] _.differenceWith
- [ ] _.flatMap
- [ ] _.fromPairs
- [ ] _.intersectionBy
- [ ] _.intersectionWith
- [ ] _.join
- [ ] _.pullAll
- [ ] _.pullAllBy
- [ ] _.reverse
- [ ] _.sortedLastIndexOf
- [ ] _.unionBy
- [ ] _.unionWith
- [ ] _.uniqWith
- [ ] _.xorBy
- [ ] _.xorWith
- [ ] _.toString
- [ ] _.invoke
- [ ] _.setWith
- [ ] _.toPairs
- [ ] _.toPairsIn
- [ ] _.unset
- [ ] _.replace
- [ ] _.split
- [ ] _.cond
- [ ] _.nthArg
- [ ] _.over
- [ ] _.overEvery
- [ ] _.overSome
- [ ] _.rangeRight
- [ ] _.next
*/
export = _;
export as namespace _;
declare let _: _.LoDashStatic;
type PartialObject<T> = Partial<T>;
declare namespace _ {
type Many<T> = T | T[];
interface LoDashStatic {
/**
* Creates a lodash object which wraps value to enable implicit method chain sequences.
* Methods that operate on and return arrays, collections, and functions can be chained together.
* Methods that retrieve a single value or may return a primitive value will automatically end the
* chain sequence and return the unwrapped value. Otherwise, the value must be unwrapped with value().
*
* Explicit chain sequences, which must be unwrapped with value(), may be enabled using _.chain.
*
* The execution of chained methods is lazy, that is, it's deferred until value() is
* implicitly or explicitly called.
*
* Lazy evaluation allows several methods to support shortcut fusion. Shortcut fusion
* is an optimization to merge iteratee calls; this avoids the creation of intermediate
* arrays and can greatly reduce the number of iteratee executions. Sections of a chain
* sequence qualify for shortcut fusion if the section is applied to an array and iteratees
* accept only one argument. The heuristic for whether a section qualifies for shortcut
* fusion is subject to change.
*
* Chaining is supported in custom builds as long as the value() method is directly or
* indirectly included in the build.
*
* In addition to lodash methods, wrappers have Array and String methods.
* The wrapper Array methods are:
* concat, join, pop, push, shift, sort, splice, and unshift.
* The wrapper String methods are:
* replace and split.
*
* The wrapper methods that support shortcut fusion are:
* at, compact, drop, dropRight, dropWhile, filter, find, findLast, head, initial, last,
* map, reject, reverse, slice, tail, take, takeRight, takeRightWhile, takeWhile, and toArray
*
* The chainable wrapper methods are:
* after, ary, assign, assignIn, assignInWith, assignWith, at, before, bind, bindAll, bindKey,
* castArray, chain, chunk, commit, compact, concat, conforms, constant, countBy, create,
* curry, debounce, defaults, defaultsDeep, defer, delay, difference, differenceBy, differenceWith,
* drop, dropRight, dropRightWhile, dropWhile, extend, extendWith, fill, filter, flatMap,
* flatMapDeep, flatMapDepth, flatten, flattenDeep, flattenDepth, flip, flow, flowRight,
* fromPairs, functions, functionsIn, groupBy, initial, intersection, intersectionBy, intersectionWith,
* invert, invertBy, invokeMap, iteratee, keyBy, keys, keysIn, map, mapKeys, mapValues,
* matches, matchesProperty, memoize, merge, mergeWith, method, methodOf, mixin, negate,
* nthArg, omit, omitBy, once, orderBy, over, overArgs, overEvery, overSome, partial, partialRight,
* partition, pick, pickBy, plant, property, propertyOf, pull, pullAll, pullAllBy, pullAllWith, pullAt,
* push, range, rangeRight, rearg, reject, remove, rest, reverse, sampleSize, set, setWith,
* shuffle, slice, sort, sortBy, sortedUniq, sortedUniqBy, splice, spread, tail, take,
* takeRight, takeRightWhile, takeWhile, tap, throttle, thru, toArray, toPairs, toPairsIn,
* toPath, toPlainObject, transform, unary, union, unionBy, unionWith, uniq, uniqBy, uniqWith,
* unset, unshift, unzip, unzipWith, update, updateWith, values, valuesIn, without, wrap,
* xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, and zipWith.
*
* The wrapper methods that are not chainable by default are:
* add, attempt, camelCase, capitalize, ceil, clamp, clone, cloneDeep, cloneDeepWith, cloneWith,
* conformsTo, deburr, defaultTo, divide, each, eachRight, endsWith, eq, escape, escapeRegExp,
* every, find, findIndex, findKey, findLast, findLastIndex, findLastKey, first, floor, forEach,
* forEachRight, forIn, forInRight, forOwn, forOwnRight, get, gt, gte, has, hasIn, head,
* identity, includes, indexOf, inRange, invoke, isArguments, isArray, isArrayBuffer,
* isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith,
* isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN,
* isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp,
* isSafeInteger, isSet, isString, isUndefined, isTypedArray, isWeakMap, isWeakSet, join,
* kebabCase, last, lastIndexOf, lowerCase, lowerFirst, lt, lte, max, maxBy, mean, meanBy,
* min, minBy, multiply, noConflict, noop, now, nth, pad, padEnd, padStart, parseInt, pop,
* random, reduce, reduceRight, repeat, result, round, runInContext, sample, shift, size,
* snakeCase, some, sortedIndex, sortedIndexBy, sortedLastIndex, sortedLastIndexBy, startCase,
* startsWith, stubArray, stubFalse, stubObject, stubString, stubTrue, subtract, sum, sumBy,
* template, times, toFinite, toInteger, toJSON, toLength, toLower, toNumber, toSafeInteger,
* toString, toUpper, trim, trimEnd, trimStart, truncate, unescape, uniqueId, upperCase,
* upperFirst, value, and words.
**/
<T>(value: T): LoDashImplicitWrapper<T>;
/**
* The semantic version number.
**/
VERSION: string;
/**
* By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby
* (ERB). Change the following template settings to use alternative delimiters.
**/
templateSettings: TemplateSettings;
}
/**
* By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby
* (ERB). Change the following template settings to use alternative delimiters.
**/
interface TemplateSettings {
/**
* The "escape" delimiter.
**/
escape?: RegExp;
/**
* The "evaluate" delimiter.
**/
evaluate?: RegExp;
/**
* An object to import into the template as local variables.
**/
imports?: Dictionary<any>;
/**
* The "interpolate" delimiter.
**/
interpolate?: RegExp;
/**
* Used to reference the data object in the template text.
**/
variable?: string;
}
/**
* Creates a cache object to store key/value pairs.
*/
interface MapCache {
/**
* Removes `key` and its value from the cache.
* @param key The key of the value to remove.
* @return Returns `true` if the entry was removed successfully, else `false`.
*/
delete(key: string): boolean;
/**
* Gets the cached value for `key`.
* @param key The key of the value to get.
* @return Returns the cached value.
*/
get(key: string): any;
/**
* Checks if a cached value for `key` exists.
* @param key The key of the entry to check.
* @return Returns `true` if an entry for `key` exists, else `false`.
*/
has(key: string): boolean;
/**
* Sets `value` to `key` of the cache.
* @param key The key of the value to cache.
* @param value The value to cache.
* @return Returns the cache object.
*/
set(key: string, value: any): Dictionary<any>;
/**
* Removes all key-value entries from the map.
*/
clear(): void;
}
interface MapCacheConstructor {
new (): MapCache;
}
interface LoDashWrapper<TValue> { }
interface LoDashImplicitWrapper<TValue> extends LoDashWrapper<TValue> {
pop<T>(this: LoDashImplicitWrapper<List<T> | null | undefined>): T | undefined;
push<T>(this: LoDashImplicitWrapper<List<T> | null | undefined>, ...items: T[]): this;
shift<T>(this: LoDashImplicitWrapper<List<T> | null | undefined>): T | undefined;
sort<T>(this: LoDashImplicitWrapper<List<T> | null | undefined>, compareFn?: (a: T, b: T) => number): this;
splice<T>(this: LoDashImplicitWrapper<List<T> | null | undefined>, start: number, deleteCount?: number, ...items: T[]): this;
unshift<T>(this: LoDashImplicitWrapper<List<T> | null | undefined>, ...items: T[]): this;
}
interface LoDashExplicitWrapper<TValue> extends LoDashWrapper<TValue> {
pop<T>(this: LoDashExplicitWrapper<List<T> | null | undefined>): LoDashExplicitWrapper<T | undefined>;
push<T>(this: LoDashExplicitWrapper<List<T> | null | undefined>, ...items: T[]): this;
shift<T>(this: LoDashExplicitWrapper<List<T> | null | undefined>): LoDashExplicitWrapper<T | undefined>;
sort<T>(this: LoDashExplicitWrapper<List<T> | null | undefined>, compareFn?: (a: T, b: T) => number): this;
splice<T>(this: LoDashExplicitWrapper<List<T> | null | undefined>, start: number, deleteCount?: number, ...items: T[]): this;
unshift<T>(this: LoDashExplicitWrapper<List<T> | null | undefined>, ...items: T[]): this;
}
/*********
* Array *
*********/
//_.chunk
interface LoDashStatic {
/**
* Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the
* final chunk will be the remaining elements.
*
* @param array The array to process.
* @param size The length of each chunk.
* @return Returns the new array containing chunks.
*/
chunk<T>(
array: List<T> | null | undefined,
size?: number
): T[][];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.chunk
*/
chunk<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
size?: number,
): LoDashImplicitWrapper<T[][]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.chunk
*/
chunk<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
size?: number,
): LoDashExplicitWrapper<T[][]>;
}
//_.compact
interface LoDashStatic {
/**
* Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are
* falsey.
*
* @param array The array to compact.
* @return Returns the new array of filtered values.
*/
compact<T>(array: List<T | null | undefined | false | "" | 0> | null | undefined): T[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.compact
*/
compact<T>(this: LoDashImplicitWrapper<List<T | null | undefined | false | "" | 0> | null | undefined>): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.compact
*/
compact<T>(this: LoDashExplicitWrapper<List<T | null | undefined | false | "" | 0> | null | undefined>): LoDashExplicitWrapper<T[]>;
}
//_.concat
interface LoDashStatic {
/**
* Creates a new array concatenating `array` with any additional arrays
* and/or values.
*
* @category Array
* @param array The array to concatenate.
* @param [values] The values to concatenate.
* @returns Returns the new concatenated array.
* @example
*
* var array = [1];
* var other = _.concat(array, 2, [3], [[4]]);
*
* console.log(other);
* // => [1, 2, 3, [4]]
*
* console.log(array);
* // => [1]
*/
concat<T>(array: Many<T>, ...values: Array<Many<T>>): T[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.compact
*/
concat<T>(this: LoDashImplicitWrapper<Many<T>>, ...values: Array<Many<T>>): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.compact
*/
concat<T>(this: LoDashExplicitWrapper<Many<T>>, ...values: Array<Many<T>>): LoDashExplicitWrapper<T[]>;
}
//_.difference
interface LoDashStatic {
/**
* Creates an array of unique array values not included in the other provided arrays using SameValueZero for
* equality comparisons.
*
* @param array The array to inspect.
* @param values The arrays of values to exclude.
* @return Returns the new array of filtered values.
*/
difference<T>(
array: List<T> | null | undefined,
...values: Array<List<T>>
): T[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.difference
*/
difference<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
...values: Array<List<T>>
): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.difference
*/
difference<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
...values: Array<List<T>>
): LoDashExplicitWrapper<T[]>;
}
//_.differenceBy
interface LoDashStatic {
/**
* This method is like _.difference except that it accepts iteratee which is invoked for each element of array
* and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one
* argument: (value).
*
* @param array The array to inspect.
* @param values The values to exclude.
* @param iteratee The iteratee invoked per element.
* @returns Returns the new array of filtered values.
*/
differenceBy<T1, T2>(
array: List<T1> | null | undefined,
values: List<T2>,
iteratee: ValueIteratee<T1 | T2>
): T1[];
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3>(
array: List<T1> | null | undefined,
values1: List<T2>,
values2: List<T3>,
iteratee: ValueIteratee<T1 | T2 | T3>
): T1[];
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3, T4>(
array: List<T1> | null | undefined,
values1: List<T2>,
values2: List<T3>,
values3: List<T4>,
iteratee: ValueIteratee<T1 | T2 | T3 | T4>
): T1[];
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3, T4, T5>(
array: List<T1> | null | undefined,
values1: List<T2>,
values2: List<T3>,
values3: List<T4>,
values4: List<T5>,
iteratee: ValueIteratee<T1 | T2 | T3 | T4 | T5>
): T1[];
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3, T4, T5, T6>(
array: List<T1> | null | undefined,
values1: List<T2>,
values2: List<T3>,
values3: List<T4>,
values4: List<T5>,
values5: List<T6>,
iteratee: ValueIteratee<T1 | T2 | T3 | T4 | T5 | T6>
): T1[];
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3, T4, T5, T6, T7>(
array: List<T1> | null | undefined,
values1: List<T2>,
values2: List<T3>,
values3: List<T4>,
values4: List<T5>,
values5: List<T6>,
...values: Array<List<T7> | ValueIteratee<T1 | T2 | T3 | T4 | T5 | T6 | T7>>
): T1[];
/**
* @see _.differenceBy
*/
differenceBy<T>(
array: List<T> | null | undefined,
...values: Array<List<T>>
): T[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.differenceBy
*/
differenceBy<T1, T2>(
this: LoDashImplicitWrapper<List<T1> | null | undefined>,
values: List<T2>,
iteratee: ValueIteratee<T1 | T2>
): LoDashImplicitWrapper<T1[]>;
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3>(
this: LoDashImplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
iteratee: ValueIteratee<T1 | T2 | T3>
): LoDashImplicitWrapper<T1[]>;
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3, T4>(
this: LoDashImplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
values3: List<T4>,
iteratee: ValueIteratee<T1 | T2 | T3 | T4>
): LoDashImplicitWrapper<T1[]>;
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3, T4, T5>(
this: LoDashImplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
values3: List<T4>,
values4: List<T5>,
iteratee: ValueIteratee<T1 | T2 | T3 | T4 | T5>
): LoDashImplicitWrapper<T1[]>;
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3, T4, T5, T6>(
this: LoDashImplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
values3: List<T4>,
values4: List<T5>,
values5: List<T6>,
iteratee: ValueIteratee<T1 | T2 | T3 | T4 | T5 | T6>
): LoDashImplicitWrapper<T1[]>;
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3, T4, T5, T6, T7>(
this: LoDashImplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
values3: List<T4>,
values4: List<T5>,
values5: List<T6>,
...values: Array<List<T7> | ValueIteratee<T1 | T2 | T3 | T4 | T5 | T6 | T7>>
): LoDashImplicitWrapper<T1[]>;
/**
* @see _.differenceBy
*/
differenceBy<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
...values: Array<List<T>>
): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.differenceBy
*/
differenceBy<T1, T2>(
this: LoDashExplicitWrapper<List<T1> | null | undefined>,
values: List<T2>,
iteratee: ValueIteratee<T1 | T2>
): LoDashExplicitWrapper<T1[]>;
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3>(
this: LoDashExplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
iteratee: ValueIteratee<T1 | T2 | T3>
): LoDashExplicitWrapper<T1[]>;
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3, T4>(
this: LoDashExplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
values3: List<T4>,
iteratee: ValueIteratee<T1 | T2 | T3 | T4>
): LoDashExplicitWrapper<T1[]>;
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3, T4, T5>(
this: LoDashExplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
values3: List<T4>,
values4: List<T5>,
iteratee: ValueIteratee<T1 | T2 | T3 | T4 | T5>
): LoDashExplicitWrapper<T1[]>;
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3, T4, T5, T6>(
this: LoDashExplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
values3: List<T4>,
values4: List<T5>,
values5: List<T6>,
iteratee: ValueIteratee<T1 | T2 | T3 | T4 | T5 | T6>
): LoDashExplicitWrapper<T1[]>;
/**
* @see _.differenceBy
*/
differenceBy<T1, T2, T3, T4, T5, T6, T7>(
this: LoDashExplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
values3: List<T4>,
values4: List<T5>,
values5: List<T6>,
...values: Array<List<T7> | ValueIteratee<T1 | T2 | T3 | T4 | T5 | T6 | T7>>
): LoDashExplicitWrapper<T1[]>;
/**
* @see _.differenceBy
*/
differenceBy<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
...values: Array<List<T>>
): LoDashExplicitWrapper<T[]>;
}
//_.differenceWith
interface LoDashStatic {
/**
* Creates an array of unique `array` values not included in the other
* provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons.
*
* @category Array
* @param [values] The arrays to inspect.
* @param [comparator] The comparator invoked per element.
* @returns Returns the new array of filtered values.
* @example
*
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
* _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
* // => [{ 'x': 2, 'y': 1 }]
*/
differenceWith<T1, T2>(
array: List<T1> | null | undefined,
values: List<T2>,
comparator: Comparator2<T1, T2>
): T1[];
/**
* @see _.differenceWith
*/
differenceWith<T1, T2, T3>(
array: List<T1> | null | undefined,
values1: List<T2>,
values2: List<T3>,
comparator: Comparator2<T1, T2 | T3>
): T1[];
/**
* @see _.differenceWith
*/
differenceWith<T1, T2, T3, T4>(
array: List<T1> | null | undefined,
values1: List<T2>,
values2: List<T3>,
...values: Array<List<T4> | Comparator2<T1, T2 | T3 | T4>>
): T1[];
/**
* @see _.differenceWith
*/
differenceWith<T>(
array: List<T> | null | undefined,
...values: Array<List<T>>
): T[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.differenceWith
*/
differenceWith<T1, T2>(
this: LoDashImplicitWrapper<List<T1> | null | undefined>,
values: List<T2>,
comparator: Comparator2<T1, T2>
): LoDashImplicitWrapper<T1[]>;
/**
* @see _.differenceWith
*/
differenceWith<T1, T2, T3>(
this: LoDashImplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
comparator: Comparator2<T1, T2 | T3>
): LoDashImplicitWrapper<T1[]>;
/**
* @see _.differenceWith
*/
differenceWith<T1, T2, T3, T4>(
this: LoDashImplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
...values: Array<List<T4> | Comparator2<T1, T2 | T3 | T4>>
): LoDashImplicitWrapper<T1[]>;
/**
* @see _.differenceWith
*/
differenceWith<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
...values: Array<List<T>>
): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.differenceWith
*/
differenceWith<T1, T2>(
this: LoDashExplicitWrapper<List<T1> | null | undefined>,
values: List<T2>,
comparator: Comparator2<T1, T2>
): LoDashExplicitWrapper<T1[]>;
/**
* @see _.differenceWith
*/
differenceWith<T1, T2, T3>(
this: LoDashExplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
comparator: Comparator2<T1, T2 | T3>
): LoDashExplicitWrapper<T1[]>;
/**
* @see _.differenceWith
*/
differenceWith<T1, T2, T3, T4>(
this: LoDashExplicitWrapper<List<T1> | null | undefined>,
values1: List<T2>,
values2: List<T3>,
...values: Array<List<T4> | Comparator2<T1, T2 | T3 | T4>>
): LoDashExplicitWrapper<T1[]>;
/**
* @see _.differenceWith
*/
differenceWith<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
...values: Array<List<T>>
): LoDashExplicitWrapper<T[]>;
}
//_.drop
interface LoDashStatic {
/**
* Creates a slice of array with n elements dropped from the beginning.
*
* @param array The array to query.
* @param n The number of elements to drop.
* @return Returns the slice of array.
*/
drop<T>(array: List<T> | null | undefined, n?: number): T[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.drop
*/
drop<T>(this: LoDashImplicitWrapper<List<T> | null | undefined>, n?: number): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.drop
*/
drop<T>(this: LoDashExplicitWrapper<List<T> | null | undefined>, n?: number): LoDashExplicitWrapper<T[]>;
}
//_.dropRight
interface LoDashStatic {
/**
* Creates a slice of array with n elements dropped from the end.
*
* @param array The array to query.
* @param n The number of elements to drop.
* @return Returns the slice of array.
*/
dropRight<T>(
array: List<T> | null | undefined,
n?: number
): T[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.dropRight
*/
dropRight<T>(this: LoDashImplicitWrapper<List<T> | null | undefined>, n?: number): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.dropRight
*/
dropRight<T>(this: LoDashExplicitWrapper<List<T> | null | undefined>, n?: number): LoDashExplicitWrapper<T[]>;
}
//_.dropRightWhile
interface LoDashStatic {
/**
* Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate
* returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array).
*
* If a property name is provided for predicate the created _.property style callback returns the property
* value of the given element.
*
* If a value is also provided for thisArg the created _.matchesProperty style callback returns true for
* elements that have a matching property value, else false.
*
* If an object is provided for predicate the created _.matches style callback returns true for elements that
* match the properties of the given object, else false.
*
* @param array The array to query.
* @param predicate The function invoked per iteration.
* @param thisArg The this binding of predicate.
* @return Returns the slice of array.
*/
dropRightWhile<T>(
array: List<T> | null | undefined,
predicate?: ListIteratee<T>
): T[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.dropRightWhile
*/
dropRightWhile<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
predicate?: ListIteratee<T>
): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.dropRightWhile
*/
dropRightWhile<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
predicate?: ListIteratee<T>
): LoDashExplicitWrapper<T[]>;
}
//_.dropWhile
interface LoDashStatic {
/**
* Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate
* returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array).
*
* If a property name is provided for predicate the created _.property style callback returns the property
* value of the given element.
*
* If a value is also provided for thisArg the created _.matchesProperty style callback returns true for
* elements that have a matching property value, else false.
*
* If an object is provided for predicate the created _.matches style callback returns true for elements that
* have the properties of the given object, else false.
*
* @param array The array to query.
* @param predicate The function invoked per iteration.
* @param thisArg The this binding of predicate.
* @return Returns the slice of array.
*/
dropWhile<T>(
array: List<T> | null | undefined,
predicate?: ListIteratee<T>
): T[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.dropWhile
*/
dropWhile<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
predicate?: ListIteratee<T>
): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.dropWhile
*/
dropWhile<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
predicate?: ListIteratee<T>
): LoDashExplicitWrapper<T[]>;
}
//_.fill
interface LoDashStatic {
/**
* Fills elements of array with value from start up to, but not including, end.
*
* Note: This method mutates array.
*
* @param array The array to fill.
* @param value The value to fill array with.
* @param start The start position.
* @param end The end position.
* @return Returns array.
*/
fill<T>(
array: any[] | null | undefined,
value: T
): T[];
/**
* @see _.fill
*/
fill<T>(
array: List<any> | null | undefined,
value: T
): List<T>;
/**
* @see _.fill
*/
fill<T, U>(
array: U[] | null | undefined,
value: T,
start?: number,
end?: number
): Array<T | U>;
/**
* @see _.fill
*/
fill<T, U>(
array: List<U> | null | undefined,
value: T,
start?: number,
end?: number
): List<T | U>;
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.fill
*/
fill<T>(
this: LoDashImplicitWrapper<any[] | null | undefined>,
value: T
): LoDashImplicitWrapper<T[]>;
/**
* @see _.fill
*/
fill<T>(
this: LoDashImplicitWrapper<List<any> | null | undefined>,
value: T
): LoDashImplicitWrapper<List<T>>;
/**
* @see _.fill
*/
fill<T, U>(
this: LoDashImplicitWrapper<U[] | null | undefined>,
value: T,
start?: number,
end?: number
): LoDashImplicitWrapper<Array<T | U>>;
/**
* @see _.fill
*/
fill<T, U>(
this: LoDashImplicitWrapper<List<U> | null | undefined>,
value: T,
start?: number,
end?: number
): LoDashImplicitWrapper<List<T | U>>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.fill
*/
fill<T>(
this: LoDashExplicitWrapper<any[] | null | undefined>,
value: T
): LoDashExplicitWrapper<T[]>;
/**
* @see _.fill
*/
fill<T>(
this: LoDashExplicitWrapper<List<any> | null | undefined>,
value: T
): LoDashExplicitWrapper<List<T>>;
/**
* @see _.fill
*/
fill<T, U>(
this: LoDashExplicitWrapper<U[] | null | undefined>,
value: T,
start?: number,
end?: number
): LoDashExplicitWrapper<Array<T | U>>;
/**
* @see _.fill
*/
fill<T, U>(
this: LoDashExplicitWrapper<List<U> | null | undefined>,
value: T,
start?: number,
end?: number
): LoDashExplicitWrapper<List<T | U>>;
}
//_.findIndex
interface LoDashStatic {
/**
* This method is like _.find except that it returns the index of the first element predicate returns truthy
* for instead of the element itself.
*
* If a property name is provided for predicate the created _.property style callback returns the property
* value of the given element.
*
* If a value is also provided for thisArg the created _.matchesProperty style callback returns true for
* elements that have a matching property value, else false.
*
* If an object is provided for predicate the created _.matches style callback returns true for elements that
* have the properties of the given object, else false.
*
* @param array The array to search.
* @param predicate The function invoked per iteration.
* @param fromIndex The index to search from.
* @return Returns the index of the found element, else -1.
*/
findIndex<T>(
array: List<T> | null | undefined,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): number;
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.findIndex
*/
findIndex<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): number;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.findIndex
*/
findIndex<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): LoDashExplicitWrapper<number>;
}
//_.findLastIndex
interface LoDashStatic {
/**
* This method is like _.findIndex except that it iterates over elements of collection from right to left.
*
* If a property name is provided for predicate the created _.property style callback returns the property
* value of the given element.
*
* If a value is also provided for thisArg the created _.matchesProperty style callback returns true for
* elements that have a matching property value, else false.
*
* If an object is provided for predicate the created _.matches style callback returns true for elements that
* have the properties of the given object, else false.
*
* @param array The array to search.
* @param predicate The function invoked per iteration.
* @param fromIndex The index to search from.
* @return Returns the index of the found element, else -1.
*/
findLastIndex<T>(
array: List<T> | null | undefined,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): number;
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.findLastIndex
*/
findLastIndex<T>(
this: LoDashImplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): number;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.findLastIndex
*/
findLastIndex<T>(
this: LoDashExplicitWrapper<List<T> | null | undefined>,
predicate?: ListIterateeCustom<T, boolean>,
fromIndex?: number
): LoDashExplicitWrapper<number>;
}
//_.first
interface LoDashStatic {
first: typeof _.head; // tslint:disable-line:no-unnecessary-qualifier
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.head
*/
first<T>(this: LoDashImplicitWrapper<List<T> | null | undefined>): T | undefined;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.head
*/
first<T>(this: LoDashExplicitWrapper<List<T> | null | undefined>): LoDashExplicitWrapper<T | undefined>;
}
interface RecursiveArray<T> extends Array<T|RecursiveArray<T>> {}
interface ListOfRecursiveArraysOrValues<T> extends List<T|RecursiveArray<T>> {}
//_.flatten
interface LoDashStatic {
/**
* Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it’s only
* flattened a single level.
*
* @param array The array to flatten.
* @param isDeep Specify a deep flatten.
* @return Returns the new flattened array.
*/
flatten<T>(array: ListOfRecursiveArraysOrValues<T> | null | undefined, isDeep: boolean): T[];
/**
* @see _.flatten
*/
flatten<T>(array: List<Many<T>> | null | undefined): T[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.flatten
*/
flatten<T>(this: LoDashImplicitWrapper<ListOfRecursiveArraysOrValues<T> | null | undefined>, isDeep: boolean): LoDashImplicitWrapper<T[]>;
/**
* @see _.flatten
*/
flatten<T>(this: LoDashImplicitWrapper<List<Many<T>> | null | undefined>): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.flatten
*/
flatten<T>(this: LoDashExplicitWrapper<ListOfRecursiveArraysOrValues<T> | null | undefined>, isDeep: boolean): LoDashExplicitWrapper<T[]>;
/**
* @see _.flatten
*/
flatten<T>(this: LoDashExplicitWrapper<List<Many<T>> | null | undefined>): LoDashExplicitWrapper<T[]>;
}
//_.flattenDeep
interface LoDashStatic {
/**
* Recursively flattens a nested array.
*
* @param array The array to recursively flatten.
* @return Returns the new flattened array.
*/
flattenDeep<T>(array: ListOfRecursiveArraysOrValues<T> | null | undefined): T[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.flattenDeep
*/
flattenDeep<T>(this: LoDashImplicitWrapper<ListOfRecursiveArraysOrValues<T> | null | undefined>): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.flattenDeep
*/
flattenDeep<T>(this: LoDashExplicitWrapper<ListOfRecursiveArraysOrValues<T> | null | undefined>): LoDashExplicitWrapper<T[]>;
}
// _.flattenDepth
interface LoDashStatic {
/**
* Recursively flatten array up to depth times.
*
* @param array The array to recursively flatten.
* @param number The maximum recursion depth.
* @return Returns the new flattened array.
*/
flattenDepth<T>(array: ListOfRecursiveArraysOrValues<T> | null | undefined, depth?: number): T[];
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.flattenDeep
*/
flattenDepth<T>(this: LoDashImplicitWrapper<ListOfRecursiveArraysOrValues<T> | null | undefined>, depth?: number): LoDashImplicitWrapper<T[]>;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.flattenDeep
*/
flattenDepth<T>(this: LoDashExplicitWrapper<ListOfRecursiveArraysOrValues<T> | null | undefined>, depth?: number): LoDashExplicitWrapper<T[]>;
}
//_.fromPairs
interface LoDashStatic {
/**
* The inverse of `_.toPairs`; this method returns an object composed
* from key-value `pairs`.
*
* @category Array
* @param pairs The key-value pairs.
* @returns Returns the new object.
* @example
*
* _.fromPairs([['fred', 30], ['barney', 40]]);
* // => { 'fred': 30, 'barney': 40 }
*/
fromPairs<T>(
pairs: List<[PropertyName, T]> | null | undefined
): Dictionary<T>;
/**
@see _.fromPairs
*/
fromPairs(
pairs: List<any[]> | null | undefined
): Dictionary<any>;
}
//_.fromPairs
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.fromPairs
*/
fromPairs<T>(
this: LoDashImplicitWrapper<List<[PropertyName, T]> | null | undefined>
): LoDashImplicitWrapper<Dictionary<T>>;
/**
@see _.fromPairs
*/
fromPairs(
this: LoDashImplicitWrapper<List<any[]> | null | undefined>
): LoDashImplicitWrapper<Dictionary<any>>;
}
//_.fromPairs
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.fromPairs
*/
fromPairs<T>(
this: LoDashExplicitWrapper<List<[PropertyName, T]> | null | undefined>
): LoDashExplicitWrapper<Dictionary<T>>;
/**
@see _.fromPairs
*/
fromPairs(
this: LoDashExplicitWrapper<List<any[]> | null | undefined>
): LoDashExplicitWrapper<Dictionary<any>>;
}