42 lines
883 B
JavaScript
42 lines
883 B
JavaScript
var _curry3 =
|
|
/*#__PURE__*/
|
|
require("./internal/_curry3.js");
|
|
|
|
var always =
|
|
/*#__PURE__*/
|
|
require("./always.js");
|
|
|
|
var over =
|
|
/*#__PURE__*/
|
|
require("./over.js");
|
|
/**
|
|
* Returns the result of "setting" the portion of the given data structure
|
|
* focused by the given lens to the given value.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.16.0
|
|
* @category Object
|
|
* @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
|
|
* @sig Lens s a -> a -> s -> s
|
|
* @param {Lens} lens
|
|
* @param {*} v
|
|
* @param {*} x
|
|
* @return {*}
|
|
* @see R.view, R.over, R.lens, R.lensIndex, R.lensProp, R.lensPath
|
|
* @example
|
|
*
|
|
* const xLens = R.lensProp('x');
|
|
*
|
|
* R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2}
|
|
* R.set(xLens, 8, {x: 1, y: 2}); //=> {x: 8, y: 2}
|
|
*/
|
|
|
|
|
|
var set =
|
|
/*#__PURE__*/
|
|
_curry3(function set(lens, v, x) {
|
|
return over(lens, always(v), x);
|
|
});
|
|
|
|
module.exports = set; |