source: node_modules/ramda/src/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: 883 bytes
Line 
1var _curry3 =
2/*#__PURE__*/
3require("./internal/_curry3.js");
4
5var always =
6/*#__PURE__*/
7require("./always.js");
8
9var over =
10/*#__PURE__*/
11require("./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
36var set =
37/*#__PURE__*/
38_curry3(function set(lens, v, x) {
39 return over(lens, always(v), x);
40});
41
42module.exports = set;
Note: See TracBrowser for help on using the repository browser.