72c162ee254d0227bf539ab6d6c3702d6dbb6860
[yaffs-website] / parent.js
1 var baseSlice = require('./baseSlice'),
2     get = require('../get');
3
4 /**
5  * Gets the parent value at `path` of `object`.
6  *
7  * @private
8  * @param {Object} object The object to query.
9  * @param {Array} path The path to get the parent value of.
10  * @returns {*} Returns the parent value.
11  */
12 function parent(object, path) {
13   return path.length == 1 ? object : get(object, baseSlice(path, 0, -1));
14 }
15
16 module.exports = parent;