Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_baseUnset.js 580B

1234567891011121314151617181920
  1. var castPath = require('./_castPath'),
  2. last = require('./last'),
  3. parent = require('./_parent'),
  4. toKey = require('./_toKey');
  5. /**
  6. * The base implementation of `_.unset`.
  7. *
  8. * @private
  9. * @param {Object} object The object to modify.
  10. * @param {Array|string} path The property path to unset.
  11. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  12. */
  13. function baseUnset(object, path) {
  14. path = castPath(path, object);
  15. object = parent(object, path);
  16. return object == null || delete object[toKey(last(path))];
  17. }
  18. module.exports = baseUnset;