1 | var _curry1 =
|
2 | /*#__PURE__*/
|
3 | require("./internal/_curry1");
|
4 |
|
5 | var assoc =
|
6 | /*#__PURE__*/
|
7 | require("./assoc");
|
8 |
|
9 | var lens =
|
10 | /*#__PURE__*/
|
11 | require("./lens");
|
12 |
|
13 | var prop =
|
14 | /*#__PURE__*/
|
15 | require("./prop");
|
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; |
\ | No newline at end of file |