mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-13 08:57:26 +08:00
Merge pull request #1295 from tmmueller/lodash/chained/map
Add definitions for _(...).map, _(...).collect
This commit is contained in:
@@ -395,10 +395,18 @@ result = <number[]>_.map([1, 2, 3], function(num) { return num * 3; });
|
||||
result = <number[]>_.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
|
||||
result = <IStoogesAge[]>_.map(stoogesAges, 'name');
|
||||
|
||||
result = <number[]>_([1, 2, 3]).map(function(num) { return num * 3; }).value();
|
||||
result = <number[]>_({ 'one': 1, 'two': 2, 'three': 3 }).map(function(num) { return num * 3; }).value();
|
||||
result = <IStoogesAge[]>_(stoogesAges).map('name').value();
|
||||
|
||||
result = <number[]>_.collect([1, 2, 3], function(num) { return num * 3; });
|
||||
result = <number[]>_.collect({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
|
||||
result = <IStoogesAge[]>_.collect(stoogesAges, 'name');
|
||||
|
||||
result = <number[]>_([1, 2, 3]).collect(function(num) { return num * 3; }).value();
|
||||
result = <number[]>_({ 'one': 1, 'two': 2, 'three': 3 }).collect(function(num) { return num * 3; }).value();
|
||||
result = <IStoogesAge[]>_(stoogesAges).collect('name').value();
|
||||
|
||||
result = <number>_.max([4, 2, 8, 6]);
|
||||
result = <IStoogesAge>_.max(stoogesAges, function(stooge) { return stooge.age; });
|
||||
result = <IStoogesAge>_.max(stoogesAges, 'age');
|
||||
|
||||
45
lodash/lodash.d.ts
vendored
45
lodash/lodash.d.ts
vendored
@@ -1913,6 +1913,51 @@ declare module _ {
|
||||
pluckValue: string): TResult[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.map
|
||||
**/
|
||||
map<T, TResult>(
|
||||
callback: ListIterator<T, TResult>,
|
||||
thisArg?: any): LoDashArrayWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.map
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
map<T, TResult>(
|
||||
pluckValue: string): LoDashArrayWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.map
|
||||
**/
|
||||
collect<T, TResult>(
|
||||
callback: ListIterator<T, TResult>,
|
||||
thisArg?: any): LoDashArrayWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.map
|
||||
**/
|
||||
collect<T, TResult>(
|
||||
pluckValue: string): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.map
|
||||
**/
|
||||
map<T extends {}, TResult>(
|
||||
callback: ObjectIterator<T, TResult>,
|
||||
thisArg?: any): LoDashObjectWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.map
|
||||
**/
|
||||
collect<T extends {}, TResult>(
|
||||
callback: ObjectIterator<T, TResult>,
|
||||
thisArg?: any): LoDashObjectWrapper<T>;
|
||||
}
|
||||
|
||||
//_.max
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user