diff --git a/underscore/underscore-tests.ts b/underscore/underscore-tests.ts index 4c7d85688..aa70ea4d9 100644 --- a/underscore/underscore-tests.ts +++ b/underscore/underscore-tests.ts @@ -9,6 +9,7 @@ _.map([1, 2, 3], (num) => num * 3); _.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3); var sum = _.reduce([1, 2, 3], (memo, num) => memo + num, 0); +sum = _.reduce([1, 2, 3], (memo, num) => memo + num); // memo is optional #issue 5 github var list = [[0, 1], [2, 3], [4, 5]]; var flat = _.reduceRight(list, (a, b) => a.concat(b), []); @@ -22,8 +23,8 @@ _.where(listOfPlays, { author: "Shakespeare", year: 1611 }); var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); -_.all([true, 1, null, 'yes'], _.identity); -_.all([true, 1, null, 'yes']); +_.every([true, 1, null, 'yes'], _.identity); +_.every<{}>([true, 1, null, 'yes']); _.any([null, 0, 'yes', false]); @@ -48,6 +49,13 @@ _([1.3, 2.1, 2.4]).groupBy((e) => Math.floor(e)); _.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num).toString()); _.groupBy(['one', 'two', 'three'], 'length'); +_.indexBy(stooges, 'age')['40'].age; +_(stooges).indexBy('age')['40'].name; +_(stooges) + .chain() + .indexBy('age') + .value()['40'].age; + _.countBy([1, 2, 3, 4, 5], (num) => (num % 2 == 0) ? 'even' : 'odd'); _.shuffle([1, 2, 3, 4, 5, 6]); @@ -158,6 +166,23 @@ _.defaults(iceCream, { flavor: "vanilla", sprinkles: "lots" }); _.clone({ name: 'moe' }); _.clone(['i', 'am', 'an', 'object!']); + +_([1, 2, 3, 4]) + .chain() + .filter((num: number) => { + return num % 2 == 0; + }).tap(alert) + .map((num: number) => { + return num * num; + }) + .value(); + +_.chain([1, 2, 3, 200]) + .filter(function (num: number) { return num % 2 == 0; }) + .tap(alert) + .map(function (num: number) { return num * num }) + .value(); + _.has({ a: 1, b: 2, c: 3 }, "b"); var moe = { name: 'moe', luckyNumbers: [13, 27, 34] }; @@ -252,7 +277,6 @@ _.template("Using 'with': <%= data.answer %>", { answer: 'no' }, { variable: 'da _(['test', 'test']).pick(['test2', 'test2']); - //////////////// Chain Tests function chain_tests() { var list:number[] = _.chain([1, 2, 3, 4, 5, 6, 7, 8]) @@ -276,7 +300,3 @@ function chain_tests() { .map(function (num: number) { return num * num }) .value(); } - - - - \ No newline at end of file diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index a0c0bea80..a0e5ec9dc 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1,16 +1,10 @@ -// Type definitions for Underscore 1.4 +// Type definitions for Underscore 1.5.2 // Project: http://underscorejs.org/ // Definitions by: // Boris Yankov // Josh Baldwin // Definitions: https://github.com/borisyankov/DefinitelyTyped -// Notes: -// 1) Parameter types may be declared as List and Dictionary. -// However, return types must be declared as T[] where possible -// otherwise Array functions are not available on returns. -// 2) Callbacks do not use '?' parameters! - /** * Underscore OOP Wrapper, all Underscore functions that take an object * as the first parameter can be invoked through this function. @@ -21,6 +15,22 @@ declare function _(value: T): _; declare module _ { + /** + * underscore.js _.throttle options. + **/ + interface ThrottleSettings { + + /** + * If you'd like to disable the leading-edge call, pass this as false. + **/ + leading?: boolean; + + /** + * If you'd like to disable the execution on the trailing-edge, pass false. + **/ + trailing?: boolean; + } + /** * underscore.js template settings, set templateSettings or pass as an argument * to 'template()' to overide defaults. @@ -167,7 +177,7 @@ declare module _ { export function reduce( list: Collection, iterator: MemoIterator, - memo: TResult, + memo?: TResult, context?: any): TResult; /** @@ -176,7 +186,7 @@ declare module _ { export function inject( list: Collection, iterator: MemoIterator, - memo: TResult, + memo?: TResult, context?: any): TResult; /** @@ -185,7 +195,7 @@ declare module _ { export function foldl( list: Collection, iterator: MemoIterator, - memo: TResult, + memo?: TResult, context?: any): TResult; /** @@ -201,7 +211,7 @@ declare module _ { export function reduceRight( list: Collection, iterator: MemoIterator, - memo: TResult, + memo?: TResult, context?: any): TResult; /** @@ -210,7 +220,7 @@ declare module _ { export function foldr( list: Collection, iterator: MemoIterator, - memo: TResult, + memo?: TResult, context?: any): TResult; /** @@ -295,21 +305,21 @@ declare module _ { * Returns true if all of the values in the list pass the iterator truth test. Delegates to the * native method every, if present. * @param list Truth test against all elements within this list. - * @param iterator Trust test iterator function for each element in `list`, optional. + * @param iterator Trust test iterator function for each element in `list`. * @param context `this` object in `iterator`, optional. * @return True if all elements passed the truth test, otherwise false. **/ - export function all( + export function every( list: Collection, - iterator?: ListIterator, + iterator: ListIterator, context?: any): boolean; /** * @see _.all **/ - export function every( + export function all( list: Collection, - iterator?: ListIterator, + iterator: ListIterator, context?: any): boolean; /** @@ -368,11 +378,11 @@ declare module _ { * property values. * @param list The list to pluck elements out of that have the property `propertyName`. * @param propertyName The property to look for on each element within `list`. - * @return The list of values for `propertyName` for each element within `list` + * @return The list of elements within `list` that have the property `propertyName`. **/ export function pluck( list: Collection, - propertyName: string): any[]; + propertyName: string): T[]; /** * Returns the maximum value in list. @@ -452,13 +462,31 @@ declare module _ { /** * @see _.groupBy - * @param iterator Group iterator for each element within `list`, return the key to group the element by. + * @param iterator Property on each object to group them by. **/ export function groupBy( list: List, iterator: string, context?: any): Dictionary; + /** + * Given a `list`, and an `iterator` function that returns a key for each element in the list (or a property name), + * returns an object with an index of each item. Just like _.groupBy, but for when you know your keys are unique. + **/ + export function indexBy( + list: List, + iterator: ListIterator, + context?: any): Dictionary; + + /** + * @see _.indexBy + * @param iterator Property on each object to index them by. + **/ + export function indexBy( + list: List, + iterator: string, + context?: any): Dictionary; + /** * Sorts a list into groups and returns a count for the number of objects in each group. Similar * to groupBy, but instead of returning a list of values, returns a count for the number of values @@ -489,6 +517,18 @@ declare module _ { **/ export function shuffle(list: Collection): T[]; + /** + * Produce a random sample from the `list`. Pass a number to return `n` random elements from the list. Otherwise a single random item will be returned. + * @param list List to sample. + * @return Random sample of `n` elements in `list`. + **/ + export function sample(list: Collection, n: number): T[]; + + /** + * @see _.sample + **/ + export function sample(list: Collection): T; + /** * Converts the list (anything that can be iterated over), into a real Array. Useful for transmuting * the arguments object. @@ -799,7 +839,7 @@ declare module _ { start: number, stop: number, step?: number): number[]; - + /** * @see _.range * @param stop Stop here. @@ -860,7 +900,7 @@ declare module _ { **/ export function memoize( fn: Function, - hashFn?: (...n: any[]) => string): Function; + hashFn?: (n: any) => string): Function; /** * Much like setTimeout, invokes function after wait milliseconds. If you pass the optional arguments, @@ -897,13 +937,19 @@ declare module _ { * Creates and returns a new, throttled version of the passed function, that, when invoked repeatedly, * will only actually call the original function at most once per every wait milliseconds. Useful for * rate-limiting events that occur faster than you can keep up with. + * By default, throttle will execute the function as soon as you call it for the first time, and, + * if you call it again any number of times during the wait period, as soon as that period is over. + * If you'd like to disable the leading-edge call, pass {leading: false}, and if you'd like to disable + * the execution on the trailing-edge, pass {trailing: false}. * @param fn Function to throttle `waitMS` ms. * @param wait The number of milliseconds to wait before `fn` can be invoked again. + * @param options Allows for disabling execution of the throttled function on either the leading or trailing edge. * @return `fn` with a throttle of `wait`. **/ export function throttle( func: any, - wait: number): Function; + wait: number, + options?: ThrottleSettings): Function; /** * Creates and returns a new debounced version of the passed function that will postpone its execution @@ -1030,8 +1076,9 @@ declare module _ { * @keys The key/value pairs to keep on `object`. * @return Copy of `object` with only the `keys` properties. **/ - export function pick(object: any, ...keys: string[]): any; - export function pick(object: any, keys: string[]): any; + export function pick( + object: any, + ...keys: string[]): any; /** * Return a copy of the object, filtered to omit the blacklisted keys (or array of keys). @@ -1039,8 +1086,19 @@ declare module _ { * @param keys The key/value pairs to remove on `object`. * @return Copy of `object` without the `keys` properties. **/ - export function omit(object: any, ...keys: string[]): any; - export function omit(object: any, keys: string[]): any; + export function omit( + object: any, + ...keys: string[]): any; +<<<<<<< HEAD +======= + + /** + * @see _.omit + **/ + export function omit( + object: any, + keys: string[]): any; +>>>>>>> Upgraded underscore to v1.5.2 /** * Fill in null and undefined properties in object with values from the defaults objects, @@ -1155,7 +1213,7 @@ declare module _ { /** * Returns true if object is either true or false. * @param object Check if this object is a bool. - * @return True if `object` is a boolean, otherwise false. + * @return True if `object` is a bool, otherwise false. **/ export function isBoolean(object: any): boolean; @@ -1308,7 +1366,7 @@ declare module _ { * @param obj Object to chain. * @return Wrapped `obj`. **/ - export function chain(obj: any): _Chain; + export function chain(obj: any): _Chain; /** * Extracts the value of a wrapped object. @@ -1371,28 +1429,28 @@ declare class _ { * Wrapped type `any[]`. * @see _.reduce **/ - reduce(iterator: _.MemoIterator, memo: TResult, context?: any): TResult; + reduce(iterator: _.MemoIterator, memo?: TResult, context?: any): TResult; /** * @see _.reduce **/ - inject(iterator: _.MemoIterator, memo: TResult, context?: any): TResult; + inject(iterator: _.MemoIterator, memo?: TResult, context?: any): TResult; /** * @see _.reduce **/ - foldl(iterator: _.MemoIterator, memo: TResult, context?: any): TResult; + foldl(iterator: _.MemoIterator, memo?: TResult, context?: any): TResult; /** * Wrapped type `any[]`. * @see _.reduceRight **/ - reduceRight(iterator: _.MemoIterator, memo: TResult, context?: any): TResult; + reduceRight(iterator: _.MemoIterator, memo?: TResult, context?: any): TResult; /** * @see _.reduceRight **/ - foldr(iterator: _.MemoIterator, memo: TResult, context?: any): TResult; + foldr(iterator: _.MemoIterator, memo?: TResult, context?: any): TResult; /** * Wrapped type `any[]`. @@ -1438,12 +1496,12 @@ declare class _ { * Wrapped type `any[]`. * @see _.all **/ - all(iterator: _.ListIterator, context?: any): boolean; + all(iterator?: _.ListIterator, context?: any): boolean; /** * @see _.all **/ - every(iterator: _.ListIterator, context?: any): boolean; + every(iterator?: _.ListIterator, context?: any): boolean; /** * Wrapped type `any[]`. @@ -1540,6 +1598,18 @@ declare class _ { **/ groupBy(iterator: string, context?: any): _.Dictionary; + /** + * Wrapped type `any[]`. + * @see _.indexBy + **/ + indexBy(iterator: _.ListIterator, context?: any): _.Dictionary; + + /** + * Wrapped type `any[]`. + * @see _.indexBy + **/ + indexBy(iterator: string, context?: any): _.Dictionary; + /** * Wrapped type `any[]`. * @see _.countBy @@ -1557,6 +1627,17 @@ declare class _ { * @see _.shuffle **/ shuffle(): T[]; + + /** + * Wrapped type `any[]`. + * @see _.sample + **/ + sample(n: number): T[]; + + /** + * @see _.sample + **/ + sample(): T; /** * Wrapped type `any`. @@ -1776,7 +1857,7 @@ declare class _ { * Wrapped type `Function`. * @see _.memoize **/ - memoize(hashFn?: (...n: any[]) => string): Function; + memoize(hashFn?: (n: any) => string): Function; /** * Wrapped type `Function`. @@ -1799,7 +1880,7 @@ declare class _ { * Wrapped type `Function`. * @see _.throttle **/ - throttle(wait: number): Function; + throttle(wait: number, options?: _.ThrottleSettings): Function; /** * Wrapped type `Function`. @@ -2075,7 +2156,7 @@ declare class _ { * Wrapped type `any`. * @see _.chain **/ - chain(): _Chain; + chain(): _Chain; /** * Wrapped type `any`. @@ -2094,247 +2175,278 @@ interface _Chain { * Wrapped type `any[]`. * @see _.each **/ - each(iterator: _.ListIterator, context?: any): _Chain; + each(iterator: _.ListIterator, context?: any): _Chain; /** * @see _.each **/ - each(iterator: _.ObjectIterator, context?: any): _Chain; + each(iterator: _.ObjectIterator, context?: any): _Chain; /** * @see _.each **/ - forEach(iterator: _.ListIterator, context?: any): _Chain; + forEach(iterator: _.ListIterator, context?: any): _Chain; /** * @see _.each **/ - forEach(iterator: _.ObjectIterator, context?: any): _Chain; + forEach(iterator: _.ObjectIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.map **/ - map(iterator: _.ListIterator, context?: any): _Chain; + map(iterator: _.ListIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.map **/ - map(iterator: _.ObjectIterator, context?: any): _Chain; + map(iterator: _.ObjectIterator, context?: any): _Chain; /** * @see _.map **/ - collect(iterator: _.ListIterator, context?: any): _Chain; + collect(iterator: _.ListIterator, context?: any): _Chain; /** * @see _.map **/ - collect(iterator: _.ObjectIterator, context?: any): _Chain; + collect(iterator: _.ObjectIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.reduce **/ - reduce(iterator: _.MemoIterator, memo: TResult, context?: any): _Chain; + reduce(iterator: _.MemoIterator, memo?: TResult, context?: any): _Chain; /** * @see _.reduce **/ - inject(iterator: _.MemoIterator, memo: TResult, context?: any): _Chain; + inject(iterator: _.MemoIterator, memo?: TResult, context?: any): _Chain; /** * @see _.reduce **/ - foldl(iterator: _.MemoIterator, memo: TResult, context?: any): _Chain; + foldl(iterator: _.MemoIterator, memo?: TResult, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.reduceRight **/ - reduceRight(iterator: _.MemoIterator, memo: TResult, context?: any): _Chain; + reduceRight(iterator: _.MemoIterator, memo?: TResult, context?: any): _Chain; /** * @see _.reduceRight **/ - foldr(iterator: _.MemoIterator, memo: TResult, context?: any): _Chain; + foldr(iterator: _.MemoIterator, memo?: TResult, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.find **/ - find(iterator: _.ListIterator, context?: any): _Chain; + find(iterator: _.ListIterator, context?: any): _Chain; /** * @see _.find **/ - detect(iterator: _.ListIterator, context?: any): _Chain; + detect(iterator: _.ListIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.filter **/ - filter(iterator: _.ListIterator, context?: any): _Chain; + filter(iterator: _.ListIterator, context?: any): _Chain; /** * @see _.filter **/ - select(iterator: _.ListIterator, context?: any): _Chain; + select(iterator: _.ListIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.where **/ - where(properties: U): _Chain; + where(properties: U): _Chain; /** * Wrapped type `any[]`. * @see _.findWhere **/ - findWhere(properties: U): _Chain; + findWhere(properties: U): _Chain; /** * Wrapped type `any[]`. * @see _.reject **/ - reject(iterator: _.ListIterator, context?: any): _Chain; + reject(iterator: _.ListIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.all **/ - all(iterator: _.ListIterator, context?: any): _Chain; +<<<<<<< HEAD + all(iterator: _.ListIterator, context?: any): _Chain; +======= + all(iterator?: _.ListIterator, context?: any): _Chain; +>>>>>>> Upgraded underscore to v1.5.2 /** * @see _.all **/ - every(iterator: _.ListIterator, context?: any): _Chain; +<<<<<<< HEAD + every(iterator: _.ListIterator, context?: any): _Chain; +======= + every(iterator?: _.ListIterator, context?: any): _Chain; +>>>>>>> Upgraded underscore to v1.5.2 /** * Wrapped type `any[]`. * @see _.any **/ - any(iterator?: _.ListIterator, context?: any): _Chain; + any(iterator?: _.ListIterator, context?: any): _Chain; /** * @see _.any **/ - some(iterator?: _.ListIterator, context?: any): _Chain; + some(iterator?: _.ListIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.contains **/ - contains(value: T): _Chain; + contains(value: T): _Chain; /** * Alias for 'contains'. * @see contains **/ - include(value: T): _Chain; + include(value: T): _Chain; /** * Wrapped type `any[]`. * @see _.invoke **/ - invoke(methodName: string, ...arguments: any[]): _Chain; + invoke(methodName: string, ...arguments: any[]): _Chain; /** * Wrapped type `any[]`. * @see _.pluck **/ - pluck(propertyName: string): _Chain; + pluck(propertyName: string): _Chain; /** * Wrapped type `number[]`. * @see _.max **/ - max(): _Chain; + max(): _Chain; /** * Wrapped type `any[]`. * @see _.max **/ - max(iterator: _.ListIterator, context?: any): _Chain; + max(iterator: _.ListIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.max **/ - max(iterator?: _.ListIterator, context?: any): _Chain; + max(iterator?: _.ListIterator, context?: any): _Chain; /** * Wrapped type `number[]`. * @see _.min **/ - min(): _Chain; + min(): _Chain; /** * Wrapped type `any[]`. * @see _.min **/ - min(iterator: _.ListIterator, context?: any): _Chain; + min(iterator: _.ListIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.min **/ - min(iterator?: _.ListIterator, context?: any): _Chain; + min(iterator?: _.ListIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.sortBy **/ - sortBy(iterator?: _.ListIterator, context?: any): _Chain; + sortBy(iterator?: _.ListIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.sortBy **/ - sortBy(iterator: string, context?: any): _Chain; + sortBy(iterator: string, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.groupBy **/ - groupBy(iterator?: _.ListIterator, context?: any): _Chain; + groupBy(iterator?: _.ListIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.groupBy **/ - groupBy(iterator: string, context?: any): _Chain; + groupBy(iterator: string, context?: any): _Chain; + + /** + * Wrapped type `any[]`. + * @see _.indexBy + **/ + indexBy(iterator: _.ListIterator, context?: any): _Chain; + + /** + * Wrapped type `any[]`. + * @see _.indexBy + **/ + indexBy(iterator: string, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.countBy **/ - countBy(iterator?: _.ListIterator, context?: any): _Chain; + countBy(iterator?: _.ListIterator, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.countBy **/ - countBy(iterator: string, context?: any): _Chain; + countBy(iterator: string, context?: any): _Chain; /** * Wrapped type `any[]`. * @see _.shuffle **/ - shuffle(): _Chain; + shuffle(): _Chain; + + /** + * Wrapped type `any[]`. + * @see _.sample + **/ + sample(n: number): _Chain; + + /** + * @see _.sample + **/ + sample(): _Chain; /** * Wrapped type `any`. * @see _.toArray **/ - toArray(): _Chain; + toArray(): _Chain; /** * Wrapped type `any`. * @see _.size **/ - size(): _Chain; + size(): _Chain; /********* * Arrays * @@ -2344,177 +2456,177 @@ interface _Chain { * Wrapped type `any[]`. * @see _.first **/ - first(): _Chain; + first(): _Chain; /** * Wrapped type `any[]`. * @see _.first **/ - first(n: number): _Chain; + first(n: number): _Chain; /** * @see _.first **/ - head(): _Chain; + head(): _Chain; /** * @see _.first **/ - head(n: number): _Chain; + head(n: number): _Chain; /** * @see _.first **/ - take(): _Chain; + take(): _Chain; /** * @see _.first **/ - take(n: number): _Chain; + take(n: number): _Chain; /** * Wrapped type `any[]`. * @see _.initial **/ - initial(n?: number): _Chain; + initial(n?: number): _Chain; /** * Wrapped type `any[]`. * @see _.last **/ - last(): _Chain; + last(): _Chain; /** * Wrapped type `any[]`. * @see _.last **/ - last(n: number): _Chain; + last(n: number): _Chain; /** * Wrapped type `any[]`. * @see _.rest **/ - rest(n?: number): _Chain; + rest(n?: number): _Chain; /** * @see _.rest **/ - tail(n?: number): _Chain; + tail(n?: number): _Chain; /** * @see _.rest **/ - drop(n?: number): _Chain; + drop(n?: number): _Chain; /** * Wrapped type `any[]`. * @see _.compact **/ - compact(): _Chain; + compact(): _Chain; /** * Wrapped type `any`. * @see _.flatten **/ - flatten(shallow?: boolean): _Chain; + flatten(shallow?: boolean): _Chain; /** * Wrapped type `any[]`. * @see _.without **/ - without(...values: T[]): _Chain; + without(...values: T[]): _Chain; /** * Wrapped type `any[][]`. * @see _.union **/ - union(...arrays: _.List[]): _Chain; + union(...arrays: _.List[]): _Chain; /** * Wrapped type `any[][]`. * @see _.intersection **/ - intersection(...arrays: _.List[]): _Chain; + intersection(...arrays: _.List[]): _Chain; /** * Wrapped type `any[]`. * @see _.difference **/ - difference(...others: _.List[]): _Chain; + difference(...others: _.List[]): _Chain; /** * Wrapped type `any[]`. * @see _.uniq **/ - uniq(isSorted?: boolean, iterator?: _.ListIterator): _Chain; + uniq(isSorted?: boolean, iterator?: _.ListIterator): _Chain; /** * Wrapped type `any[]`. * @see _.uniq **/ - uniq(iterator?: _.ListIterator, context?: any): _Chain; + uniq(iterator?: _.ListIterator, context?: any): _Chain; /** * @see _.uniq **/ - unique(isSorted?: boolean, iterator?: _.ListIterator): _Chain; + unique(isSorted?: boolean, iterator?: _.ListIterator): _Chain; /** * @see _.uniq **/ - unique(iterator?: _.ListIterator, context?: any): _Chain; + unique(iterator?: _.ListIterator, context?: any): _Chain; /** * Wrapped type `any[][]`. * @see _.zip **/ - zip(...arrays: any[][]): _Chain; + zip(...arrays: any[][]): _Chain; /** * Wrapped type `any[][]`. * @see _.object **/ - object(...keyValuePairs: any[][]): _Chain; + object(...keyValuePairs: any[][]): _Chain; /** * @see _.object **/ - object(values?: any): _Chain; + object(values?: any): _Chain; /** * Wrapped type `any[]`. * @see _.indexOf **/ - indexOf(value: T, isSorted?: boolean): _Chain; + indexOf(value: T, isSorted?: boolean): _Chain; /** * @see _.indexOf **/ - indexOf(value: T, startFrom: number): _Chain; + indexOf(value: T, startFrom: number): _Chain; /** * Wrapped type `any[]`. * @see _.lastIndexOf **/ - lastIndexOf(value: T, from?: number): _Chain; + lastIndexOf(value: T, from?: number): _Chain; /** * Wrapped type `any[]`. * @see _.sortedIndex **/ - sortedIndex(value: T, iterator?: (x: T) => any, context?: any): _Chain; + sortedIndex(value: T, iterator?: (x: T) => any, context?: any): _Chain; /** * Wrapped type `number`. * @see _.range **/ - range(stop: number, step?: number): _Chain; + range(stop: number, step?: number): _Chain; /** * Wrapped type `number`. * @see _.range **/ - range(): _Chain; + range(): _Chain; /* *********** * Functions * @@ -2524,78 +2636,78 @@ interface _Chain { * Wrapped type `Function`. * @see _.bind **/ - bind(object: any, ...arguments: any[]): _Chain; + bind(object: any, ...arguments: any[]): _Chain; /** * Wrapped type `object`. * @see _.bindAll **/ - bindAll(...methodNames: string[]): _Chain; + bindAll(...methodNames: string[]): _Chain; /** * Wrapped type `Function`. * @see _.partial **/ - partial(...arguments: any[]): _Chain; + partial(...arguments: any[]): _Chain; /** * Wrapped type `Function`. * @see _.memoize **/ - memoize(hashFn?: (...n: any[]) => string): _Chain; + memoize(hashFn?: (n: any) => string): _Chain; /** * Wrapped type `Function`. * @see _.defer **/ - defer(...arguments: any[]): _Chain; + defer(...arguments: any[]): _Chain; /** * Wrapped type `Function`. * @see _.delay **/ - delay(wait: number, ...arguments: any[]): _Chain; + delay(wait: number, ...arguments: any[]): _Chain; /** * @see _.delay **/ - delay(...arguments: any[]): _Chain; + delay(...arguments: any[]): _Chain; /** * Wrapped type `Function`. * @see _.throttle **/ - throttle(wait: number): _Chain; + throttle(wait: number, options?: _.ThrottleSettings): _Chain; /** * Wrapped type `Function`. * @see _.debounce **/ - debounce(wait: number, immediate?: boolean): _Chain; + debounce(wait: number, immediate?: boolean): _Chain; /** * Wrapped type `Function`. * @see _.once **/ - once(): _Chain; + once(): _Chain; /** * Wrapped type `number`. * @see _.after **/ - after(func: Function): _Chain; + after(func: Function): _Chain; /** * Wrapped type `Function`. * @see _.wrap **/ - wrap(wrapper: Function): () => _Chain; + wrap(wrapper: Function): () => _Chain; /** * Wrapped type `Function[]`. * @see _.compose **/ - compose(...functions: Function[]): _Chain; + compose(...functions: Function[]): _Chain; /********* * * Objects * @@ -2605,176 +2717,174 @@ interface _Chain { * Wrapped type `object`. * @see _.keys **/ - keys(): _Chain; + keys(): _Chain; /** * Wrapped type `object`. * @see _.values **/ - values(): _Chain; + values(): _Chain; /** * Wrapped type `object`. * @see _.pairs **/ - pairs(): _Chain; + pairs(): _Chain; /** * Wrapped type `object`. * @see _.invert **/ - invert(): _Chain; + invert(): _Chain; /** * Wrapped type `object`. * @see _.functions **/ - functions(): _Chain; + functions(): _Chain; /** * @see _.functions **/ - methods(): _Chain; + methods(): _Chain; /** * Wrapped type `object`. * @see _.extend **/ - extend(...sources: any[]): _Chain; + extend(...sources: any[]): _Chain; /** * Wrapped type `object`. * @see _.pick **/ - pick(...keys: string[]): _Chain; - pick(keys: string[]): _Chain; + pick(...keys: string[]): _Chain; /** * Wrapped type `object`. * @see _.omit **/ - omit(...keys: string[]): _Chain; - omit(keys: string[]): _Chain; + omit(...keys: string[]): _Chain; /** * Wrapped type `object`. * @see _.defaults **/ - defaults(...defaults: any[]): _Chain; + defaults(...defaults: any[]): _Chain; /** * Wrapped type `any[]`. * @see _.clone **/ - clone(): _Chain; + clone(): _Chain; /** * Wrapped type `object`. * @see _.tap **/ - tap(interceptor: (...as: any[]) => any): _Chain; + tap(interceptor: (...as: any[]) => any): _Chain; /** * Wrapped type `object`. * @see _.has **/ - has(key: string): _Chain; + has(key: string): _Chain; /** * Wrapped type `object`. * @see _.isEqual **/ - isEqual(other: any): _Chain; + isEqual(other: any): _Chain; /** * Wrapped type `object`. * @see _.isEmpty **/ - isEmpty(): _Chain; + isEmpty(): _Chain; /** * Wrapped type `object`. * @see _.isElement **/ - isElement(): _Chain; + isElement(): _Chain; /** * Wrapped type `object`. * @see _.isArray **/ - isArray(): _Chain; + isArray(): _Chain; /** * Wrapped type `object`. * @see _.isObject **/ - isObject(): _Chain; + isObject(): _Chain; /** * Wrapped type `object`. * @see _.isArguments **/ - isArguments(): _Chain; + isArguments(): _Chain; /** * Wrapped type `object`. * @see _.isFunction **/ - isFunction(): _Chain; + isFunction(): _Chain; /** * Wrapped type `object`. * @see _.isString **/ - isString(): _Chain; + isString(): _Chain; /** * Wrapped type `object`. * @see _.isNumber **/ - isNumber(): _Chain; + isNumber(): _Chain; /** * Wrapped type `object`. * @see _.isFinite **/ - isFinite(): _Chain; + isFinite(): _Chain; /** * Wrapped type `object`. * @see _.isBoolean **/ - isBoolean(): _Chain; + isBoolean(): _Chain; /** * Wrapped type `object`. * @see _.isDate **/ - isDate(): _Chain; + isDate(): _Chain; /** * Wrapped type `object`. * @see _.isRegExp **/ - isRegExp(): _Chain; + isRegExp(): _Chain; /** * Wrapped type `object`. * @see _.isNaN **/ - isNaN(): _Chain; + isNaN(): _Chain; /** * Wrapped type `object`. * @see _.isNull **/ - isNull(): _Chain; + isNull(): _Chain; /** * Wrapped type `object`. * @see _.isUndefined **/ - isUndefined(): _Chain; + isUndefined(): _Chain; /********* * * Utility * @@ -2784,54 +2894,54 @@ interface _Chain { * Wrapped type `any`. * @see _.identity **/ - identity(): _Chain; + identity(): _Chain; /** * Wrapped type `number`. * @see _.times **/ - times(iterator: (n: number) => TResult, context?: any): _Chain; + times(iterator: (n: number) => TResult, context?: any): _Chain; /** * Wrapped type `number`. * @see _.random **/ - random(): _Chain; + random(): _Chain; /** * Wrapped type `number`. * @see _.random **/ - random(max: number): _Chain; + random(max: number): _Chain; /** * Wrapped type `object`. * @see _.mixin **/ - mixin(): _Chain; + mixin(): _Chain; /** * Wrapped type `string`. * @see _.uniqueId **/ - uniqueId(): _Chain; + uniqueId(): _Chain; /** * Wrapped type `string`. * @see _.escape **/ - escape(): _Chain; + escape(): _Chain; /** * Wrapped type `object`. * @see _.result **/ - result(property: string): _Chain; + result(property: string): _Chain; /** * Wrapped type `string`. * @see _.template **/ - template(data?: any, settings?: _.TemplateSettings): (...data: any[]) => _Chain; + template(data?: any, settings?: _.TemplateSettings): (...data: any[]) => _Chain; /********** * * Chaining * @@ -2841,7 +2951,7 @@ interface _Chain { * Wrapped type `any`. * @see _.chain **/ - chain(): _Chain; + chain(): _Chain; /** * Wrapped type `any`.