Files
lodash/_parent.js
John-David Dalton ce0b51888c Bump to v4.7.0.
2016-03-31 00:36:47 -07:00

17 lines
429 B
JavaScript

import baseGet from './_baseGet';
import baseSlice from './_baseSlice';
/**
* Gets the parent value at `path` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} path The path to get the parent value of.
* @returns {*} Returns the parent value.
*/
function parent(object, path) {
return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
}
export default parent;