main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
866 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | var _curry1 =
|
---|
| 2 | /*#__PURE__*/
|
---|
| 3 | require("./internal/_curry1.js");
|
---|
| 4 |
|
---|
| 5 | var assoc =
|
---|
| 6 | /*#__PURE__*/
|
---|
| 7 | require("./assoc.js");
|
---|
| 8 |
|
---|
| 9 | var lens =
|
---|
| 10 | /*#__PURE__*/
|
---|
| 11 | require("./lens.js");
|
---|
| 12 |
|
---|
| 13 | var prop =
|
---|
| 14 | /*#__PURE__*/
|
---|
| 15 | require("./prop.js");
|
---|
| 16 | /**
|
---|
| 17 | * Returns a lens whose focus is the specified property.
|
---|
| 18 | *
|
---|
| 19 | * @func
|
---|
| 20 | * @memberOf R
|
---|
| 21 | * @since v0.14.0
|
---|
| 22 | * @category Object
|
---|
| 23 | * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
|
---|
| 24 | * @sig String -> Lens s a
|
---|
| 25 | * @param {String} k
|
---|
| 26 | * @return {Lens}
|
---|
| 27 | * @see R.view, R.set, R.over
|
---|
| 28 | * @example
|
---|
| 29 | *
|
---|
| 30 | * const xLens = R.lensProp('x');
|
---|
| 31 | *
|
---|
| 32 | * R.view(xLens, {x: 1, y: 2}); //=> 1
|
---|
| 33 | * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2}
|
---|
| 34 | * R.over(xLens, R.negate, {x: 1, y: 2}); //=> {x: -1, y: 2}
|
---|
| 35 | */
|
---|
| 36 |
|
---|
| 37 |
|
---|
| 38 | var lensProp =
|
---|
| 39 | /*#__PURE__*/
|
---|
| 40 | _curry1(function lensProp(k) {
|
---|
| 41 | return lens(prop(k), assoc(k));
|
---|
| 42 | });
|
---|
| 43 |
|
---|
| 44 | module.exports = lensProp; |
---|
Note:
See
TracBrowser
for help on using the repository browser.