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