UNPKG

846 BJavaScriptView Raw
1var _curry3 =
2/*#__PURE__*/
3require("./internal/_curry3");
4
5var always =
6/*#__PURE__*/
7require("./always");
8
9var over =
10/*#__PURE__*/
11require("./over");
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.prop, R.lensIndex, R.lensProp
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
36var set =
37/*#__PURE__*/
38_curry3(function set(lens, v, x) {
39 return over(lens, always(v), x);
40});
41
42module.exports = set;
\No newline at end of file