ramda: support R.__ in R.propOr

This commit is contained in:
Ivan Ha
2019-03-16 19:08:45 +08:00
parent 7d91d6eb32
commit 81e531f9ad
2 changed files with 4 additions and 0 deletions

View File

@@ -2332,6 +2332,8 @@ declare namespace R {
* If the given, non-null object has an own property with the specified name, returns the value of that property.
* Otherwise returns the provided default value.
*/
propOr<T, U>(val: T, __: Placeholder, obj: U): <V>(p: string) => V;
propOr<U>(__: Placeholder, p: string, obj: U): <T, V>(val: T) => V;
propOr<T, U, V>(val: T, p: string, obj: U): V;
propOr<T>(val: T, p: string): <U, V>(obj: U) => V;
propOr<T>(val: T): <U, V>(p: string, obj: U) => V;

View File

@@ -1967,6 +1967,8 @@ class Rectangle {
const favoriteWithDefault = R.propOr("Ramda", "favoriteLibrary");
const s2 = favoriteWithDefault(alice); // => 'Ramda'
R.propOr('Ramda', R.__, alice)('name'); // => 'ALICE'
R.propOr(R.__, 'foo', alice)('default'); // => 'default'
};
() => {