ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
35 lines (30 loc) • 998 B
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _ramda = require("ramda");
var _splitByDot = _interopRequireDefault(require("./splitByDot"));
/**
* Determines whether a dot path on an object has a specific value
* in `R.equals` terms.
*
* @func
* @category Object
* @param {any} eq Value for `R.equals`.
* @param {String} path The dot path to use.
* @param {Object} obj The object to retrieve the nested property from and compare with `eq`.
* @return {*} True if value on dot path equals to `eq`.
*
* @example
*
* R_.dotPathEq(2, 'a.b', {a: {b: 2}}); //=> true
* R_.dotPathEq(2, 'a.b', {c: {b: 2}}); //=> false
*
* @sig a -> String -> {a} -> Boolean
*
*/
var dotPathEq = (0, _ramda.useWith)(_ramda.pathEq, [_ramda.identity, _splitByDot.default, _ramda.identity]);
var _default = dotPathEq;
exports.default = _default;