UNPKG

typescript-closure-tools

Version:

Command-line tools to convert closure-style JSDoc annotations to typescript, and to convert typescript sources to closure externs files

1,868 lines (1,664 loc) 107 kB
// Type definitions for Lo-Dash // Project: http://lodash.com/ // Definitions by: Brian Zengel <https://github.com/bczengel> // Definitions: https://github.com/borisyankov/DefinitelyTyped declare var _: _.LoDashStatic; declare module _ { interface LoDashStatic { /** * Creates a lodash object which wraps the given value to enable intuitive method chaining. * * In addition to Lo-Dash methods, wrappers also have the following Array methods: * concat, join, pop, push, reverse, shift, slice, sort, splice, and unshift * * Chaining is supported in custom builds as long as the value method is implicitly or * explicitly included in the build. * * The chainable wrapper functions are: * after, assign, bind, bindAll, bindKey, chain, compact, compose, concat, countBy, * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, * remove, rest, reverse, shuffle, slice, sort, sortBy, splice, tap, throttle, times, * toArray, transform, union, uniq, unshift, unzip, values, where, without, wrap, and zip * * The non-chainable wrapper functions are: * clone, cloneDeep, contains, escape, every, find, findIndex, findKey, findLast, * findLastIndex, findLastKey, has, identity, indexOf, isArguments, isArray, isBoolean, * isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber, * isObject, isPlainObject, isRegExp, isString, isUndefined, join, lastIndexOf, mixin, * noConflict, parseInt, pop, random, reduce, reduceRight, result, shift, size, some, * sortedIndex, runInContext, template, unescape, uniqueId, and value * * The wrapper functions first and last return wrapped values when n is provided, otherwise * they return unwrapped values. * * Explicit chaining can be enabled by using the _.chain method. **/ (value: number): LoDashWrapper<number>; (value: string): LoDashWrapper<string>; (value: boolean): LoDashWrapper<boolean>; <T>(value: Array<T>): LoDashArrayWrapper<T>; <T extends {}>(value: T): LoDashObjectWrapper<T>; (value: any): LoDashWrapper<any>; /** * The semantic version number. **/ VERSION: string; /** * An object used to flag environments features. **/ support: Support; /** * 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; } /** * An object used to flag environments features. **/ interface Support { /** * Detect if an arguments object’s [[Class]] is resolvable (all but Firefox < 4, IE < 9). **/ argsClass: boolean; /** * Detect if arguments objects are Object objects (all but Narwhal and Opera < 10.5). **/ argsObject: boolean; /** * Detect if name or message properties of Error.prototype are enumerable by default. * (IE < 9, Safari < 5.1) **/ enumErrorProps: boolean; /** * Detect if Function#bind exists and is inferred to be fast (all but V8). **/ fastBind: boolean; /** * Detect if functions can be decompiled by Function#toString (all but PS3 and older Opera * mobile browsers & avoided in Windows 8 apps). **/ funcDecomp: boolean; /** * Detect if Function#name is supported (all but IE). **/ funcNames: boolean; /** * Detect if arguments object indexes are non-enumerable (Firefox < 4, IE < 9, PhantomJS, * Safari < 5.1). **/ nonEnumArgs: boolean; /** * Detect if properties shadowing those on Object.prototype are non-enumerable. * * In IE < 9 an objects own properties, shadowing non-enumerable ones, are made * non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). **/ nonEnumShadows: boolean; /** * Detect if own properties are iterated after inherited properties (all but IE < 9). **/ ownLast: boolean; /** * Detect if Array#shift and Array#splice augment array-like objects correctly. * * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array shift() and splice() * functions that fail to remove the last element, value[0], of array-like objects even * though the length property is set to 0. The shift() method is buggy in IE 8 compatibility * mode, while splice() is buggy regardless of mode in IE < 9 and buggy in compatibility mode * in IE 9. **/ spliceObjects: boolean; /** * Detect lack of support for accessing string characters by index. * * IE < 8 can't access characters by index and IE 8 can only access characters by index on * string literals. **/ unindexedChars: boolean; } interface LoDashWrapperBase<T, TWrapper> { /** * Produces the toString result of the wrapped value. * @return Returns the string result. **/ toString(): string; /** * Extracts the wrapped value. * @return The wrapped value. **/ valueOf(): T; /** * @see valueOf **/ value(): T; } interface LoDashWrapper<T> extends LoDashWrapperBase<T, LoDashWrapper<T>> {} interface LoDashObjectWrapper<T> extends LoDashWrapperBase<T, LoDashObjectWrapper<T>> {} interface LoDashArrayWrapper<T> extends LoDashWrapperBase<T[], LoDashArrayWrapper<T>> { concat(...items: T[]): LoDashArrayWrapper<T>; join(seperator?: string): LoDashWrapper<string>; pop(): LoDashWrapper<T>; push(...items: T[]): void; reverse(): LoDashArrayWrapper<T>; shift(): LoDashWrapper<T>; slice(start: number, end?: number): LoDashArrayWrapper<T>; sort(compareFn?: (a: T, b: T) => number): LoDashArrayWrapper<T>; splice(start: number): LoDashArrayWrapper<T>; splice(start: number, deleteCount: number, ...items: any[]): LoDashArrayWrapper<T>; unshift(...items: any[]): LoDashWrapper<number>; } //_.chain interface LoDashStatic { /** * Creates a lodash object that wraps the given value with explicit method chaining enabled. * @param value The value to wrap. * @return The wrapper object. **/ chain(value: number): LoDashWrapper<number>; chain(value: string): LoDashWrapper<string>; chain(value: boolean): LoDashWrapper<boolean>; chain<T>(value: Array<T>): LoDashArrayWrapper<T>; chain<T extends {}>(value: T): LoDashObjectWrapper<T>; chain(value: any): LoDashWrapper<any>; } interface LoDashWrapperBase<T, TWrapper> { /** * Enables explicit method chaining on the wrapper object. * @see _.chain * @return The wrapper object. **/ chain(): TWrapper; } //_.tap interface LoDashStatic { /** * Invokes interceptor with the value as the first argument and then returns value. The * purpose of this method is to "tap into" a method chain in order to perform operations on * intermediate results within the chain. * @param value The value to provide to interceptor * @param interceptor The function to invoke. * @return value **/ tap<T>( value: T, interceptor: (value: T) => void): T; } interface LoDashWrapperBase<T, TWrapper> { /** * @see _.tap **/ tap(interceptor: (value: T) => void): TWrapper; } /********* * Arrays * **********/ //_.compact interface LoDashStatic { /** * Returns a copy of the array with all falsy values removed. In JavaScript, false, null, 0, "", * undefined and NaN are all falsy. * @param array Array to compact. * @return (Array) Returns a new array of filtered values. **/ compact<T>(array: List<T>): T[]; } interface LoDashArrayWrapper<T> { /** * @see _.compact **/ compact<T>(): LoDashArrayWrapper<T>; } //_.difference interface LoDashStatic { /** * Creates an array excluding all values of the provided arrays using strict equality for comparisons * , i.e. ===. * @param array The array to process * @param others The arrays of values to exclude. * @return Returns a new array of filtered values. **/ difference<T>( array: List<T>, ...others: List<T>[]): T[]; } interface LoDashArrayWrapper<T> { /** * @see _.difference **/ difference( ...others: List<T>[]): LoDashArrayWrapper<T>; } //_.findIndex interface LoDashStatic { /** * This method is like _.find except that it returns the index of the first element that passes * the callback check, instead of the element itself. * @param array The array to search. * @param {(Function|Object|string)} callback The function called per iteration. If a property name or object is provided it will be * used to create a ".pluck" or ".where" style callback, respectively. * @param thisArg The this binding of callback. * @return Returns the index of the found element, else -1. **/ findIndex<T>( array: List<T>, callback: ListIterator<T, boolean>, thisArg?: any): number; /** * @see _.findIndex **/ findIndex<T>( array: List<T>, pluckValue: string): number; /** * @see _.findIndex **/ findIndex<W, T>( array: List<T>, whereDictionary: W): number; } //_.findLastIndex interface LoDashStatic { /** * This method is like _.findIndex except that it iterates over elements of a collection from right to left. * @param array The array to search. * @param {(Function|Object|string)} callback The function called per iteration. If a property name or object is provided it will be * used to create a ".pluck" or ".where" style callback, respectively. * @param thisArg The this binding of callback. * @return Returns the index of the found element, else -1. **/ findLastIndex<T>( array: List<T>, callback: ListIterator<T, boolean>, thisArg?: any): number; /** * @see _.findLastIndex **/ findLastIndex<T>( array: List<T>, pluckValue: string): number; /** * @see _.findLastIndex **/ findLastIndex<T>( array: List<T>, whereDictionary: Dictionary<any>): number; } //_.first interface LoDashStatic { /** * Gets the first element or first n elements of an array. If a callback is provided * elements at the beginning of the array are returned as long as the callback returns * truey. The callback is bound to thisArg and invoked with three arguments; (value, * index, array). * * If a property name is provided for callback the created "_.pluck" style callback * will return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return ] * true for elements that have the properties of the given object, else false. * @param array Retrieves the first element of this array. * @return Returns the first element of `array`. **/ first<T>(array: List<T>): T; /** * @see _.first * @param n The number of elements to return. **/ first<T>( array: List<T>, n: number): T[]; /** * @see _.first * @param callback The function called per element. * @param [thisArg] The this binding of callback. **/ first<T>( array: List<T>, callback: ListIterator<T, boolean>, thisArg?: any): T[]; /** * @see _.first * @param pluckValue "_.pluck" style callback value **/ first<T>( array: List<T>, pluckValue: string): T[]; /** * @see _.first * @param whereValue "_.where" style callback value **/ first<W, T>( array: List<T>, whereValue: W): T[]; /** * @see _.first **/ head<T>(array: List<T>): T; /** * @see _.first **/ head<T>( array: List<T>, n: number): T[]; /** * @see _.first **/ head<T>( array: List<T>, callback: ListIterator<T, boolean>, thisArg?: any): T[]; /** * @see _.first **/ head<T>( array: List<T>, pluckValue: string): T[]; /** * @see _.first **/ head<W, T>( array: List<T>, whereValue: W): T[]; /** * @see _.first **/ take<T>(array: List<T>): T; /** * @see _.first **/ take<T>( array: List<T>, n: number): T[]; /** * @see _.first **/ take<T>( array: List<T>, callback: ListIterator<T, boolean>, thisArg?: any): T[]; /** * @see _.first **/ take<T>( array: List<T>, pluckValue: string): T[]; /** * @see _.first **/ take<W, T>( array: List<T>, whereValue: W): T[]; } //_.flatten interface LoDashStatic { /** * Flattens a nested array (the nesting can be to any depth). If isShallow is truey, the * array will only be flattened a single level. If a callback is provided each element of * the array is passed through the callback before flattening. The callback is bound to * thisArg and invoked with three arguments; (value, index, array). * * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param array The array to flatten. * @param shallow If true then only flatten one level, optional, default = false. * @return `array` flattened. **/ flatten<T>(array: List<any>, isShallow?: boolean): T[]; flatten<T>( array: List<any>, isShallow: boolean, callback: ListIterator<any, T>, thisArg?: any): T[]; flatten<T>( array: List<any>, callback: ListIterator<any, T>, thisArg?: any): T[]; flatten<W, T>( array: List<any>, isShallow: boolean, whereValue: W): T[]; flatten<W, T>( array: List<any>, whereValue: W): T[]; flatten<T>( array: List<any>, isShallow: boolean, pluckValue: string): T[]; flatten<T>( array: List<any>, pluckValue: string): T[]; } interface LoDashArrayWrapper<T> { /** * @see _.flatten **/ flatten<Flat>(isShallow?: boolean): LoDashArrayWrapper<Flat>; flatten<Flat>( isShallow: boolean, callback: ListIterator<T, Flat>, thisArg?: any): LoDashArrayWrapper<Flat>; flatten<Flat>( callback: ListIterator<T, Flat>, thisArg?: any): LoDashArrayWrapper<Flat>; flatten<Flat>( isShallow: boolean, pluckValue: string): LoDashArrayWrapper<Flat>; flatten<Flat>( pluckValue: string): LoDashArrayWrapper<Flat>; flatten<Flat, W>( isShallow: boolean, whereValue: W): LoDashArrayWrapper<Flat>; flatten<Flat, W>( whereValue: W): LoDashArrayWrapper<Flat>; } //_.indexOf interface LoDashStatic { /** * Gets the index at which the first occurrence of value is found using strict equality * for comparisons, i.e. ===. If the array is already sorted providing true for fromIndex * will run a faster binary search. * @param array The array to search. * @param value The value to search for. * @param fromIndex The index to search from. * @return The index of `value` within `array`. **/ indexOf<T>( array: List<T>, value: T): number; /** * @see _.indexOf * @param fromIndex The index to search from **/ indexOf<T>( array: List<T>, value: T, fromIndex: number): number; /** * @see _.indexOf * @param isSorted True to perform a binary search on a sorted array. **/ indexOf<T>( array: List<T>, value: T, isSorted: boolean): number; } //_.initial interface LoDashStatic { /** * Gets all but the last element or last n elements of an array. If a callback is provided * elements at the end of the array are excluded from the result as long as the callback * returns truey. The callback is bound to thisArg and invoked with three arguments; * (value, index, array). * * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param array The array to query. * @param n Leaves this many elements behind, optional. * @return Returns everything but the last `n` elements of `array`. **/ initial<T>( array: List<T>): T[]; /** * @see _.initial * @param n The number of elements to exclude. **/ initial<T>( array: List<T>, n: number): T[]; /** * @see _.initial * @param callback The function called per element **/ initial<T>( array: List<T>, callback: ListIterator<T, boolean>): T[]; /** * @see _.initial * @param pluckValue _.pluck style callback **/ initial<T>( array: List<T>, pluckValue: string): T[]; /** * @see _.initial * @param whereValue _.where style callback **/ initial<W, T>( array: List<T>, whereValue: W): T[]; } //_.intersection interface LoDashStatic { /** * Creates an array of unique values present in all provided arrays using strict * equality for comparisons, i.e. ===. * @param arrays The arrays to inspect. * @return Returns an array of composite values. **/ intersection<T>(...arrays: List<T>[]): T[]; } //_.last interface LoDashStatic { /** * Gets the last element or last n elements of an array. If a callback is provided * elements at the end of the array are returned as long as the callback returns truey. * The callback is bound to thisArg and invoked with three arguments; (value, index, array). * * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param array The array to query. * @return Returns the last element(s) of array. **/ last<T>(array: List<T>): T; /** * @see _.last * @param n The number of elements to return **/ last<T>( array: List<T>, n: number): T[]; /** * @see _.last * @param callback The function called per element **/ last<T>( array: List<T>, callback: ListIterator<T, boolean>, thisArg?: any): T[]; /** * @see _.last * @param pluckValue _.pluck style callback **/ last<T>( array: List<T>, pluckValue: string): T[]; /** * @see _.last * @param whereValue _.where style callback **/ last<W, T>( array: List<T>, whereValue: W): T[]; } //_.lastIndexOf interface LoDashStatic { /** * Gets the index at which the last occurrence of value is found using strict equality * for comparisons, i.e. ===. If fromIndex is negative, it is used as the offset from the * end of the collection. * @param array The array to search. * @param value The value to search for. * @param fromIndex The index to search from. * @return The index of the matched value or -1. **/ lastIndexOf<T>( array: List<T>, value: T, fromIndex?: number): number; } //_.pull interface LoDashStatic { /** * Removes all provided values from the given array using strict equality for comparisons, * i.e. ===. * @param array The array to modify. * @param values The values to remove. * @return array. **/ pull( array: List<any>, ...values: any[]): any[]; } //_.range interface LoDashStatic { /** * Creates an array of numbers (positive and/or negative) progressing from start up * to but not including end. If start is less than stop a zero-length range is created * unless a negative step is specified. * @param start The start of the range. * @param end The end of the range. * @param step The value to increment or decrement by. * @return Returns a new range array. **/ range( start: number, stop: number, step?: number): number[]; /** * @see _.range * @param end The end of the range. * @return Returns a new range array. * @note If start is not specified the implementation will never pull the step (step = arguments[2] || 0) **/ range(stop: number): number[]; } //_.remove interface LoDashStatic { /** * Removes all elements from an array that the callback returns truey for and returns * an array of removed elements. The callback is bound to thisArg and invoked with three * arguments; (value, index, array). * * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param array The array to modify. * @param callback The function called per iteration. * @param thisArg The this binding of callback. * @return A new array of removed elements. **/ remove( array: List<any>, callback?: ListIterator<any, boolean>, thisArg?: any): any[]; /** * @see _.remove * @param pluckValue _.pluck style callback **/ remove( array: List<any>, pluckValue?: string): any[]; /** * @see _.remove * @param whereValue _.where style callback **/ remove( array: List<any>, wherealue?: Dictionary<any>): any[]; } //_.rest interface LoDashStatic { /** * The opposite of _.initial this method gets all but the first element or first n elements of * an array. If a callback function is provided elements at the beginning of the array are excluded * from the result as long as the callback returns truey. The callback is bound to thisArg and * invoked with three arguments; (value, index, array). * * If a property name is provided for callback the created "_.pluck" style callback will return * the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return true * for elements that have the properties of the given object, else false. * @param array The array to query. * @param {(Function|Object|number|string)} [callback=1] The function called per element or the number * of elements to exclude. If a property name or object is provided it will be used to create a * ".pluck" or ".where" style callback, respectively. * @param {*} [thisArg] The this binding of callback. * @return Returns a slice of array. **/ rest<T>(array: List<T>): T[]; /** * @see _.rest **/ rest<T>( array: List<T>, callback: ListIterator<T, boolean>, thisArg?: any): T[]; /** * @see _.rest **/ rest<T>( array: List<T>, n: number): T[]; /** * @see _.rest **/ rest<T>( array: List<T>, pluckValue: string): T[]; /** * @see _.rest **/ rest<W, T>( array: List<T>, whereValue: W): T[]; /** * @see _.rest **/ drop<T>(array: List<T>): T[]; /** * @see _.rest **/ drop<T>( array: List<T>, callback: ListIterator<T, boolean>, thisArg?: any): T[]; /** * @see _.rest **/ drop<T>( array: List<T>, n: number): T[]; /** * @see _.rest **/ drop<T>( array: List<T>, pluckValue: string): T[]; /** * @see _.rest **/ drop<W, T>( array: List<T>, whereValue: W): T[]; /** * @see _.rest **/ tail<T>(array: List<T>): T[]; /** * @see _.rest **/ tail<T>( array: List<T>, callback: ListIterator<T, boolean>, thisArg?: any): T[]; /** * @see _.rest **/ tail<T>( array: List<T>, n: number): T[]; /** * @see _.rest **/ tail<T>( array: List<T>, pluckValue: string): T[]; /** * @see _.rest **/ tail<W, T>( array: List<T>, whereValue: W): T[]; } //_.sortedIndex interface LoDashStatic { /** * Uses a binary search to determine the smallest index at which a value should be inserted * into a given sorted array in order to maintain the sort order of the array. If a callback * is provided it will be executed for value and each element of array to compute their sort * ranking. The callback is bound to thisArg and invoked with one argument; (value). * * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param array The sorted list. * @param value The value to determine its index within `list`. * @param callback Iterator to compute the sort ranking of each value, optional. * @return The index at which value should be inserted into array. **/ sortedIndex<T, TSort>( array: List<T>, value: T, callback?: (x: T) => TSort, thisArg?: any): number; /** * @see _.sortedIndex * @param pluckValue the _.pluck style callback **/ sortedIndex<T>( array: List<T>, value: T, pluckValue: string): number; /** * @see _.sortedIndex * @param pluckValue the _.where style callback **/ sortedIndex<W, T>( array: List<T>, value: T, whereValue: W): number; } //_.union interface LoDashStatic { /** * Creates an array of unique values, in order, of the provided arrays using strict * equality for comparisons, i.e. ===. * @param arrays The arrays to inspect. * @return Returns an array of composite values. **/ union<T>(...arrays: List<T>[]): T[]; } //_.uniq interface LoDashStatic { /** * Creates a duplicate-value-free version of an array using strict equality for comparisons, * i.e. ===. If the array is sorted, providing true for isSorted will use a faster algorithm. * If a callback is provided each element of array is passed through the callback before * uniqueness is computed. The callback is bound to thisArg and invoked with three arguments; * (value, index, array). * * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param array Array to remove duplicates from. * @param isSorted True if `array` is already sorted, optiona, default = false. * @param iterator Transform the elements of `array` before comparisons for uniqueness. * @param context 'this' object in `iterator`, optional. * @return Copy of `array` where all elements are unique. **/ uniq<T, TSort>(array: List<T>, isSorted?: boolean): T[]; uniq<T, TSort>( array: List<T>, isSorted: boolean, callback: ListIterator<T, TSort>, thisArg?: any): T[]; /** * @see _.uniq **/ uniq<T, TSort>( array: List<T>, callback: ListIterator<T, TSort>, thisArg?: any): T[]; /** * @see _.uniq * @param pluckValue _.pluck style callback **/ uniq<T>( array: List<T>, isSorted: boolean, pluckValue: string): T[]; uniq<T>( array: List<T>, pluckValue: string): T[]; /** * @see _.uniq * @param whereValue _.where style callback **/ uniq<W, T>( array: List<T>, isSorted: boolean, whereValue: W): T[]; uniq<W, T>( array: List<T>, whereValue: W): T[]; /** * @see _.uniq **/ unique<T>(array: List<T>, isSorted?: boolean): T[]; unique<T, TSort>( array: List<T>, callback: ListIterator<T, TSort>, thisArg?: any): T[]; /** * @see _.uniq **/ unique<T, TSort>( array: List<T>, isSorted: boolean, callback: ListIterator<T, TSort>, thisArg?: any): T[]; /** * @see _.uniq * @param pluckValue _.pluck style callback **/ unique<T>( array: List<T>, isSorted: boolean, pluckValue: string): T[]; unique<T>( array: List<T>, pluckValue: string): T[]; /** * @see _.uniq * @param whereValue _.where style callback **/ unique<W, T>( array: List<T>, whereValue?: W): T[]; unique<W, T>( array: List<T>, isSorted: boolean, whereValue?: W): T[]; } //_.without interface LoDashStatic { /** * Creates an array excluding all provided values using strict equality for comparisons, i.e. ===. * @param array The array to filter. * @param values The value(s) to exclude. * @return A new array of filtered values. **/ without<T>( array: List<T>, ...values: T[]): T[]; } //_.zip interface LoDashStatic { /** * Creates an array of grouped elements, the first of which contains the first * elements of the given arrays, the second of which contains the second elements * of the given arrays, and so on. * @param arrays Arrays to process. * @return A new array of grouped elements. **/ zip(...arrays: any[][]): any[][]; /** * @see _.zip **/ zip(...arrays: any[]): any[]; /** * @see _.zip **/ unzip(...arrays: any[][]): any[][]; /** * @see _.zip **/ unzip(...arrays: any[]): any[]; } //_.zipObject interface LoDashStatic { /** * Creates an object composed from arrays of keys and values. Provide either a single * two dimensional array, i.e. [[key1, value1], [key2, value2]] or two arrays, one of * keys and one of corresponding values. * @param keys The array of keys. * @param values The array of values. * @return An object composed of the given keys and corresponding values. **/ zipObject<TResult extends {}>( keys: List<string>, values: List<any>): TResult; /** * @see _.object **/ object<TResult extends {}>( keys: List<string>, values: List<any>): TResult; } /* ************* * Collections * ************* */ //_.at interface LoDashStatic { /** * Creates an array of elements from the specified indexes, or keys, of the collection. * Indexes may be specified as individual arguments or as arrays of indexes. * @param collection The collection to iterate over. * @param indexes The indexes of collection to retrieve, specified as individual indexes or * arrays of indexes. * @return A new array of elements corresponding to the provided indexes. **/ at<T>( collection: Collection<T>, indexes: number[]): T[]; /** * @see _.at **/ at<T>( collection: Collection<T>, ...indexes: number[]): T[]; } //_.contains interface LoDashStatic { /** * Checks if a given value is present in a collection using strict equality for comparisons, * i.e. ===. If fromIndex is negative, it is used as the offset from the end of the collection. * @param collection The collection to iterate over. * @param target The value to check for. * @param fromIndex The index to search from. * @return True if the target element is found, else false. **/ contains<T>( collection: Collection<T>, target: T, fromIndex?: number): boolean; /** * @see _.contains * @param dictionary The dictionary to iterate over. * @param key The key in the dictionary to search for. **/ contains<T>( dictionary: Dictionary<T>, key: string, fromIndex?: number): boolean; /** * @see _.contains * @param searchString the string to search * @param targetString the string to search for **/ contains( searchString: string, targetString: string, fromIndex?: number): boolean; /** * @see _.contains **/ include<T>( collection: Collection<T>, target: T, fromIndex?: number): boolean; /** * @see _.contains **/ include<T>( dictionary: Dictionary<T>, key: string, fromIndex?: number): boolean; /** * @see _.contains **/ include( searchString: string, targetString: string, fromIndex?: number): boolean; } //_.countBy interface LoDashStatic { /** * Creates an object composed of keys generated from the results of running each element * of collection through the callback. The corresponding value of each key is the number * of times the key was returned by the callback. The callback is bound to thisArg and * invoked with three arguments; (value, index|key, collection). * * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param thisArg The this binding of callback. * @return Returns the composed aggregate object. **/ countBy<T>( collection: Collection<T>, callback?: ListIterator<T, any>, thisArg?: any): Dictionary<number>; /** * @see _.countBy * @param callback Function name **/ countBy<T>( collection: Collection<T>, callback: string, thisArg?: any): Dictionary<number>; } interface LoDashArrayWrapper<T> { /** * @see _.countBy **/ countBy<T>( callback?: ListIterator<T, any>, thisArg?: any): LoDashObjectWrapper<Dictionary<number>>; /** * @see _.countBy * @param callback Function name **/ countBy<T>( callback: string, thisArg?: any): LoDashObjectWrapper<Dictionary<number>>; } //_.every interface LoDashStatic { /** * Checks if the given callback returns truey value for all elements of a collection. * The callback is bound to thisArg and invoked with three arguments; (value, index|key, * collection). * * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param thisArg The this binding of callback. * @return True if all elements passed the callback check, else false. **/ every<T>( collection: Collection<T>, callback?: ListIterator<T, boolean>, thisArg?: any): boolean; /** * @see _.every * @param pluckValue _.pluck style callback **/ every<T>( collection: Collection<T>, pluckValue: string): boolean; /** * @see _.every * @param whereValue _.where style callback **/ every<W, T>( collection: Collection<T>, whereValue: W): boolean; /** * @see _.every **/ all<T>( collection: Collection<T>, callback?: ListIterator<T, boolean>, thisArg?: any): boolean; /** * @see _.every * @param pluckValue _.pluck style callback **/ all<T>( collection: Collection<T>, pluckValue: string): boolean; /** * @see _.every * @param whereValue _.where style callback **/ all<W, T>( collection: Collection<T>, whereValue: W): boolean; } //_.filter interface LoDashStatic { /** * Iterates over elements of a collection, returning an array of all elements the * callback returns truey for. The callback is bound to thisArg and invoked with three * arguments; (value, index|key, collection). * * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param context The this binding of callback. * @return Returns a new array of elements that passed the callback check. **/ filter<T>( collection: Collection<T>, callback: ListIterator<T, boolean>, thisArg?: any): T[]; /** * @see _.filter * @param pluckValue _.pluck style callback **/ filter<T>( collection: Collection<T>, pluckValue: string): T[]; /** * @see _.filter * @param pluckValue _.pluck style callback **/ filter<W, T>( collection: Collection<T>, whereValue: W): T[]; /** * @see _.filter **/ select<T>( collection: Collection<T>, callback: ListIterator<T, boolean>, thisArg?: any): T[]; /** * @see _.filter * @param pluckValue _.pluck style callback **/ select<T>( collection: Collection<T>, pluckValue: string): T[]; /** * @see _.filter * @param pluckValue _.pluck style callback **/ select<W, T>( collection: Collection<T>, whereValue: W): T[]; } interface LoDashArrayWrapper<T> { /** * @see _.filter **/ filter<T>( callback: ListIterator<T, boolean>, thisArg?: any): LoDashArrayWrapper<T>; /** * @see _.filter * @param pluckValue _.pluck style callback **/ filter<T>( pluckValue: string): LoDashArrayWrapper<T>; /** * @see _.filter * @param pluckValue _.pluck style callback **/ filter<W, T>( whereValue: W): LoDashArrayWrapper<T>; /** * @see _.filter **/ select<T>( callback: ListIterator<T, boolean>, thisArg?: any): LoDashArrayWrapper<T>; /** * @see _.filter * @param pluckValue _.pluck style callback **/ select<T>( pluckValue: string): LoDashArrayWrapper<T>; /** * @see _.filter * @param pluckValue _.pluck style callback **/ select<W, T>( whereValue: W): LoDashArrayWrapper<T>; } //_.find interface LoDashStatic { /** * Iterates over elements of a collection, returning the first element that the callback * returns truey for. The callback is bound to thisArg and invoked with three arguments; * (value, index|key, collection). * * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param collection Searches for a value in this list. * @param callback The function called per iteration. * @param thisArg The this binding of callback. * @return The found element, else undefined. **/ find<T>( collection: Collection<T>, callback: ListIterator<T, boolean>, thisArg?: any): T; /** * @see _.find * @param _.pluck style callback **/ find<W, T>( collection: Collection<T>, whereValue: W): T; /** * @see _.find * @param _.where style callback **/ find<T>( collection: Collection<T>, pluckValue: string): T; /** * @see _.find **/ detect<T>( collection: Collection<T>, callback: ListIterator<T, boolean>, thisArg?: any): T; /** * @see _.find * @param _.pluck style callback **/ detect<W, T>( collection: Collection<T>, whereValue: W): T; /** * @see _.find * @param _.where style callback **/ detect<T>( collection: Collection<T>, pluckValue: string): T; /** * @see _.find **/ findWhere<T>( collection: Collection<T>, callback: ListIterator<T, boolean>, thisArg?: any): T; /** * @see _.find * @param _.pluck style callback **/ findWhere<W, T>( collection: Collection<T>, whereValue: W): T; /** * @see _.find * @param _.where style callback **/ findWhere<T>( collection: Collection<T>, pluckValue: string): T; } //_.findLast interface LoDashStatic { /** * This method is like _.find except that it iterates over elements of a collection from * right to left. * @param collection Searches for a value in this list. * @param callback The function called per iteration. * @param thisArg The this binding of callback. * @return The found element, else undefined. **/ findLast<T>( collection: Collection<T>, callback: ListIterator<T, boolean>, thisArg?: any): T; /** * @see _.find * @param _.pluck style callback **/ findLast<W, T>( collection: Collection<T>, whereValue: W): T; /** * @see _.find * @param _.where style callback **/ findLast<T>( collection: Collection<T>, pluckValue: string): T; } //_.forEach interface LoDashStatic { /** * Iterates over elements of a collection, executing the callback for each element. * The callback is bound to thisArg and invoked with three arguments; (value, index|key, * collection). Callbacks may exit iteration early by explicitly returning false. * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param thisArg The this binding of callback. **/ forEach<T>( collection: List<T>, callback: ListIterator<T, void >, thisArg?: any): List<T>; /** * @see _.forEach **/ forEach<T extends {}>( object: Dictionary<T>, callback: ObjectIterator<T, void >, thisArg?: any): Dictionary<T>; /** * @see _.forEach **/ each<T>( collection: List<T>, callback: ListIterator<T, void>, thisArg?: any): List<T>; /** * @see _.forEach * @param object The object to iterate over * @param callback The function called per iteration. * @param thisArg The this binding of callback. **/ each<T extends {}>( object: Dictionary<T>, callback: ObjectIterator<T, void>, thisArg?: any): Dictionary<T>; } interface LoDashArrayWrapper<T> { /** * @see _.forEach **/ forEach<T>( callback: ListIterator<T, void >, thisArg?: any): LoDashArrayWrapper<T>; /** * @see _.forEach **/ each<T>( callback: ListIterator<T, void >, thisArg?: any): LoDashArrayWrapper<T>; } interface LoDashObjectWrapper<T> { /** * @see _.forEach **/ forEach<T extends {}>( callback: ObjectIterator<T, void >, thisArg?: any): LoDashObjectWrapper<T>; /** * @see _.forEach **/ each<T extends {}>( callback: ObjectIterator<T, void >, thisArg?: any): LoDashObjectWrapper<T>; } //_.forEachRight interface LoDashStatic { /** * This method is like _.forEach except that it iterates over elements of a * collection from right to left. * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param thisArg The this binding of callback. **/ forEachRight<T>( collection: List<T>, callback: ListIterator<T, void >, thisArg?: any): List<T>; /** * @see _.forEachRight **/ forEachRight<T extends {}>( object: Dictionary<T>, callback: ObjectIterator<T, void >, thisArg?: any): Dictionary<T>; /** * @see _.forEachRight **/ eachRight<T>( collection: List<T>, callback: ListIterator<T, void>, thisArg?: any): List<T>; /** * @see _.forEachRight * @param object The object to iterate over * @param callback The function called per iteration. * @param thisArg The this binding of callback. **/ eachRight<T extends {}>( object: Dictionary<T>, callback: ObjectIterator<T, void>, thisArg?: any): Dictionary<T>; } interface LoDashArrayWrapper<T> { /** * @see _.forEachRight **/ forEachRight<T>( callback: ListIterator<T, void >, thisArg?: any): LoDashArrayWrapper<T>; /** * @see _.forEachRight **/ eachRight<T>( callback: ListIterator<T, void >, thisArg?: any): LoDashArrayWrapper<T>; } interface LoDashObjectWrapper<T> { /** * @see _.forEachRight **/ forEachRight<T extends {}>( callback: ObjectIterator<T, void >, thisArg?: any): LoDashObjectWrapper<Dictionary<T>>; /** * @see _.forEachRight * @param object The object to iterate over * @param callback The function called per iteration. * @param thisArg The this binding of callback. **/ eachRight<T extends {}>( callback: ObjectIterator<T, void>, thisArg?: any): LoDashObjectWrapper<Dictionary<T>>; } //_.groupBy interface LoDashStatic { /** * Creates an object composed of keys generated from the results of running each element * of a collection through the callback. The corresponding value of each key is an array * of the elements responsible for generating the key. The callback is bound to thisArg * and invoked with three arguments; (value, index|key, collection). * * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param thisArg The this binding of callback. * @return Returns the composed aggregate object. **/ groupBy<T>( collection: List<T>, callback?: ListIterator<T, any>, thisArg?: any): Dictionary<T[]>; /** * @see _.groupBy * @param pluckValue _.pluck style callback **/ groupBy<T>( collection: List<T>, pluckValue: string): Dictionary<T[]>; /** * @see _.groupBy * @param whereValue _.where style callback **/ groupBy<W, T>( collection: List<T>, whereValue: W): Dictionary<T[]>; } interface LoDashArrayWrapper<T> { /** * @see _.groupBy **/ groupBy<T>( callback: ListIterator<T, any>, thisArg?: any): _.LoDashObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy **/ groupBy<T>( pluckValue: string): _.LoDashObjectWrapper<Dictionary<T[]>>; /** * @see _.groupBy **/ groupBy<W, T>( whereValue: W): _.LoDashObjectWrapper<Dictionary<T[]>>; } //_.indexBy interface LoDashStatic { /** * Creates an object composed of keys generated from the results of running each element * of the collection through the given callback. The corresponding value of each key is * the last element responsible for generating the key. The callback is bound to thisArg * and invoked with three arguments; (value, index|key, collection). * * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param thisArg The this binding of callback. * @return Returns the composed aggregate object. **/ indexBy<T>( list: List<T>, iterator: ListIterator<T, any>, context?: any): Dictionary<T>; /** * @see _.indexBy * @param pluckValue _.pluck style callback **/ indexBy<T>( collection: List<T>, pluckValue: string): Dictionary<T>; /** * @see _.indexBy * @param whereValue _.where style callback **/ indexBy<W, T>( collection: List<T>, whereValue: W): Dictionary<T>; } //_.invoke interface LoDashStatic { /** * Invokes the method named by methodName on each element in the collection returning * an array of the results of each invoked method. Additional arguments will be provided * to each invoked method. If methodName is a function it will be invoked for, and this * bound to, each element in the collection. * @param collection The collection to iterate over. * @param methodName The name of the method to invoke. * @param args Arguments to invoke the method with. **/ invoke<T extends {}>( collection: Collection<T>, methodName: string, ...args: any[]): any; /** * @see _.invoke **/ invoke<T extends {}>( collection: Collection<T>, method: Function, ...args: any[]): any; } //_.map interface LoDashStatic { /** * Creates an array of values by running each element in the collection through the callback. * The callback is bound to thisArg and invoked with three arguments; (value, index|key, * collection). * * If a property name is provided for callback the created "_.pluck" style callback will return * the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return true * for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. * @param theArg The this binding of callback. * @return The mapped array result. **/ map<T, TResult>( collection: