mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
Update R.sortBy to accept Ord, per documentation
http://ramdajs.com/docs/#sortBy
This commit is contained in:
Vendored
+3
-3
@@ -1,6 +1,6 @@
|
||||
// Type definitions for ramda
|
||||
// Project: https://github.com/donnut/typescript-ramda
|
||||
// Definitions by: Erwin Poeze <https://github.com/donnut>
|
||||
// Definitions by: Erwin Poeze <https://github.com/donnut>, Matt DeKrey <https://github.com/mdekrey>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var R: R.Static;
|
||||
@@ -1402,8 +1402,8 @@ declare namespace R {
|
||||
/**
|
||||
* Sorts the list according to a key generated by the supplied function.
|
||||
*/
|
||||
sortBy<T>(fn: (a: any) => string, list: T[]): T[];
|
||||
sortBy(fn: (a: any) => string): <T>(list: T[]) => T[];
|
||||
sortBy<T>(fn: (a: any) => Ord, list: T[]): T[];
|
||||
sortBy(fn: (a: any) => Ord): <T>(list: T[]) => T[];
|
||||
|
||||
/**
|
||||
* Splits a string into an array of strings based on the given
|
||||
|
||||
@@ -1617,6 +1617,24 @@ matchPhrases(['foo', 'bar', 'baz']);
|
||||
R.path(testPath)(testObj); //=> 2
|
||||
}
|
||||
|
||||
() => {
|
||||
var sortByAgeDescending = R.sortBy(R.compose(R.negate, R.prop('age')));
|
||||
var alice = {
|
||||
name: 'ALICE',
|
||||
age: 101
|
||||
};
|
||||
var bob = {
|
||||
name: 'Bob',
|
||||
age: -10
|
||||
};
|
||||
var clara = {
|
||||
name: 'clara',
|
||||
age: 314.159
|
||||
};
|
||||
var people = [clara, bob, alice];
|
||||
sortByAgeDescending(people); //=> [alice, bob, clara]
|
||||
}
|
||||
|
||||
() => {
|
||||
var sortByNameCaseInsensitive = R.sortBy(R.compose(R.toLower, R.prop('name')));
|
||||
var alice = {
|
||||
|
||||
Reference in New Issue
Block a user