source: node_modules/ramda/es/set.js

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: 827 bytes
Line 
1import _curry3 from "./internal/_curry3.js";
2import always from "./always.js";
3import over from "./over.js";
4/**
5 * Returns the result of "setting" the portion of the given data structure
6 * focused by the given lens to the given value.
7 *
8 * @func
9 * @memberOf R
10 * @since v0.16.0
11 * @category Object
12 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
13 * @sig Lens s a -> a -> s -> s
14 * @param {Lens} lens
15 * @param {*} v
16 * @param {*} x
17 * @return {*}
18 * @see R.view, R.over, R.lens, R.lensIndex, R.lensProp, R.lensPath
19 * @example
20 *
21 * const xLens = R.lensProp('x');
22 *
23 * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2}
24 * R.set(xLens, 8, {x: 1, y: 2}); //=> {x: 8, y: 2}
25 */
26
27var set =
28/*#__PURE__*/
29_curry3(function set(lens, v, x) {
30 return over(lens, always(v), x);
31});
32
33export default set;
Note: See TracBrowser for help on using the repository browser.