ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
19 lines (18 loc) • 515 B
JavaScript
import { view, flip, o, identity, useWith } from '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 = /*#__PURE__*/useWith( /*#__PURE__*/flip(o), [view, identity, identity]);
export default viewWith;