ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
31 lines (26 loc) • 791 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"));
/**
* Retrieve the value at a given dot path.
*
* @func
* @category Object
* @param {String} path The dot path to use.
* @param {Object} obj The object to retrieve the nested property from.
* @return {*} The data at `path`.
*
* @example
*
* R_.dotPath('a.b', {a: {b: 2}}); //=> 2
* R_.dotPath('a.b', {c: {b: 2}}); //=> undefined
*
*/
var dotPath = (0, _ramda.useWith)(_ramda.path, [_splitByDot.default, _ramda.identity]);
var _default = dotPath;
exports.default = _default;