import _curry2 from "./internal/_curry2.js"; import paths from "./paths.js"; /** * Retrieves the value at a given path. The nodes of the path can be arbitrary strings or non-negative integers. * For anything else, the value is unspecified. Integer paths are meant to index arrays, strings are meant for objects. * * @func * @memberOf R * @since v0.2.0 * @category Object * @typedefn Idx = String | Int | Symbol * @sig [Idx] -> {a} -> a | Undefined * @sig Idx = String | NonNegativeInt * @param {Array} path The path to use. * @param {Object} obj The object or array to retrieve the nested property from. * @return {*} The data at `path`. * @see R.prop, R.nth, R.assocPath, R.dissocPath * @example * * R.path(['a', 'b'], {a: {b: 2}}); //=> 2 * R.path(['a', 'b'], {c: {b: 2}}); //=> undefined * R.path(['a', 'b', 0], {a: {b: [1, 2, 3]}}); //=> 1 * R.path(['a', 'b', -2], {a: {b: [1, 2, 3]}}); //=> 2 * R.path([2], {'2': 2}); //=> 2 * R.path([-2], {'-2': 'a'}); //=> undefined */ var path = /*#__PURE__*/ _curry2(function path(pathAr, obj) { return paths([pathAr], obj)[0]; }); export default path;