swc/bundler/tests/.cache/deno/3045ecf37e4546ef147d10dd710c7e3b5402725e.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

38 lines
1.0 KiB
TypeScript

// Loaded from https://deno.land/x/ramda@v0.27.2/source/lensPath.js
import _curry1 from './internal/_curry1.js';
import assocPath from './assocPath.js';
import lens from './lens.js';
import path from './path.js';
/**
* Returns a lens whose focus is the specified path.
*
* @func
* @memberOf R
* @since v0.19.0
* @category Object
* @typedefn Idx = String | Int | Symbol
* @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
* @sig [Idx] -> Lens s a
* @param {Array} path The path to use.
* @return {Lens}
* @see R.view, R.set, R.over
* @example
*
* const xHeadYLens = R.lensPath(['x', 0, 'y']);
*
* R.view(xHeadYLens, {x: [{y: 2, z: 3}, {y: 4, z: 5}]});
* //=> 2
* R.set(xHeadYLens, 1, {x: [{y: 2, z: 3}, {y: 4, z: 5}]});
* //=> {x: [{y: 1, z: 3}, {y: 4, z: 5}]}
* R.over(xHeadYLens, R.negate, {x: [{y: 2, z: 3}, {y: 4, z: 5}]});
* //=> {x: [{y: -2, z: 3}, {y: 4, z: 5}]}
*/
var lensPath = _curry1(function lensPath(p) {
return lens(path(p), assocPath(p));
});
export default lensPath;