ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
27 lines (24 loc) • 648 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _ramda = require("ramda");
/**
* Applies custom view function on the given lens
*
* @func
* @category Object
* @param {Lens} lens
* @param {*} v view function
* @param {*} x
* @return {*}
* @example
*
* R_.viewWith(R.lensIndex(0), R.pathEq(['foo'], 'boo'), [{ foo: 'boo' }]); //=> true
* R_.viewWith(R.lensIndex(0), R.divide(R.__, 2), [4]) //=> 2
*
*/
var viewWith = (0, _ramda.useWith)((0, _ramda.flip)(_ramda.o), [_ramda.view, _ramda.identity, _ramda.identity]);
var _default = viewWith;
exports.default = _default;