您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

16 行
436 B

4 年前
  1. var baseGet = require('./_baseGet'),
  2. baseSlice = require('./_baseSlice');
  3. /**
  4. * Gets the parent value at `path` of `object`.
  5. *
  6. * @private
  7. * @param {Object} object The object to query.
  8. * @param {Array} path The path to get the parent value of.
  9. * @returns {*} Returns the parent value.
  10. */
  11. function parent(object, path) {
  12. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  13. }
  14. module.exports = parent;