ramda: Add support for curry on view definition

This commit is contained in:
Michael R. Maletich
2017-05-18 12:21:13 -05:00
parent 6b64c4f2a1
commit cd4d27c57d
2 changed files with 2 additions and 0 deletions

View File

@@ -1728,6 +1728,7 @@ declare namespace R {
* portion of the data structure is visible.
*/
view<T,U>(lens: Lens, obj: T): U;
view<T,U>(lens: Lens): (obj: T) => U;
/**
* Tests the final argument by passing it to the given predicate function. If the predicate is satisfied, the function

View File

@@ -1161,6 +1161,7 @@ class Rectangle {
() => {
var xLens = R.lens(R.prop('x'), R.assoc('x'));
R.view(xLens, {x: 1, y: 2}); //=> 1
R.view(xLens)({x: 1, y: 2}); //=> 1
R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2}
R.set(xLens)(4, {x: 1, y: 2}); //=> {x: 4, y: 2}
R.set(xLens, 4)({x: 1, y: 2}); //=> {x: 4, y: 2}