Added chainable definitions for _(...).sortBy

This commit is contained in:
Brian Zengel
2014-06-02 22:06:58 -04:00
parent be19adcd82
commit b599ab50cc
2 changed files with 25 additions and 0 deletions
+4
View File
@@ -524,6 +524,10 @@ result = <number[]>_.sortBy([1, 2, 3], function (num) { return Math.sin(num); })
result = <number[]>_.sortBy([1, 2, 3], function (num) { return this.sin(num); }, Math);
result = <string[]>_.sortBy(['banana', 'strawberry', 'apple'], 'length');
result = <number[]>_([1, 2, 3]).sortBy(function (num) { return Math.sin(num); }).value();
result = <number[]>_([1, 2, 3]).sortBy(function (num) { return this.sin(num); }, Math).value();
result = <string[]>_(['banana', 'strawberry', 'apple']).sortBy('length').value();
(function (a: number, b: number, c: number, d: number) { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
result = <IStoogesCombined[]>_.where(stoogesCombined, { 'age': 40 });
+21
View File
@@ -4349,6 +4349,27 @@ declare module _ {
whereValue: W): T[];
}
interface LoDashArrayWrapper<T> {
/**
* @see _.sortBy
**/
sortBy<TSort>(
callback?: ListIterator<T, TSort>,
thisArg?: any): LoDashArrayWrapper<T>;
/**
* @see _.sortBy
* @param pluckValue _.pluck style callback
**/
sortBy(pluckValue: string): LoDashArrayWrapper<T>;
/**
* @see _.sortBy
* @param whereValue _.where style callback
**/
sortBy<W>(whereValue: W): LoDashArrayWrapper<T>;
}
//_.toArray
interface LoDashStatic {
/**