mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
ramda: Add R.pathSatisfies
This commit is contained in:
Vendored
+8
@@ -5,6 +5,7 @@
|
||||
// Liam Goodacre <https://github.com/LiamGoodacre>
|
||||
// Matt Dziuban <https://github.com/mrdziuban>
|
||||
// Stephen King <https://github.com/sbking>
|
||||
// Alejandro Fernandez Haro <https://github.com/afharo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -1195,6 +1196,13 @@ declare namespace R {
|
||||
pathOr<T>(d: T, p: Path): (obj: any) => T|any;
|
||||
pathOr<T>(d: T): CurriedFunction2<Path, any, T|any>;
|
||||
|
||||
/**
|
||||
* Returns true if the specified object property satisfies the given predicate; false otherwise.
|
||||
*/
|
||||
pathSatisfies<T,U>(pred: (val: T) => boolean, path: Path, obj: U): boolean;
|
||||
pathSatisfies<T,U>(pred: (val: T) => boolean, path: Path): (obj: U) => boolean;
|
||||
pathSatisfies<T,U>(pred: (val: T) => boolean): CurriedFunction2<Path, U, boolean>;
|
||||
|
||||
/**
|
||||
* Returns a partial copy of an object containing only the keys specified. If the key does not exist, the
|
||||
* property is ignored.
|
||||
|
||||
@@ -1294,6 +1294,12 @@ class Rectangle {
|
||||
R.pathOr(orValue, testPath, {c: {b: 2}}); //=> "N/A"
|
||||
}
|
||||
|
||||
() => {
|
||||
const a: boolean = R.pathSatisfies(x => x > 0, ['x'], {x: 1, y: 2}); //=> true
|
||||
const b: boolean = R.pathSatisfies(x => x > 0, ['x'])({x: 1, y: 2}); //=> true
|
||||
const c: boolean = R.pathSatisfies(x => x > 0)(['x'])({x: 1, y: 2}); //=> true
|
||||
}
|
||||
|
||||
() => {
|
||||
var isPositive = function(n: number) {
|
||||
return n > 0;
|
||||
|
||||
Reference in New Issue
Block a user