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.

unset.js 804B

12345678910111213141516171819202122232425262728293031323334
  1. var baseUnset = require('./_baseUnset');
  2. /**
  3. * Removes the property at `path` of `object`.
  4. *
  5. * **Note:** This method mutates `object`.
  6. *
  7. * @static
  8. * @memberOf _
  9. * @since 4.0.0
  10. * @category Object
  11. * @param {Object} object The object to modify.
  12. * @param {Array|string} path The path of the property to unset.
  13. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  14. * @example
  15. *
  16. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  17. * _.unset(object, 'a[0].b.c');
  18. * // => true
  19. *
  20. * console.log(object);
  21. * // => { 'a': [{ 'b': {} }] };
  22. *
  23. * _.unset(object, ['a', '0', 'b', 'c']);
  24. * // => true
  25. *
  26. * console.log(object);
  27. * // => { 'a': [{ 'b': {} }] };
  28. */
  29. function unset(object, path) {
  30. return object == null ? true : baseUnset(object, path);
  31. }
  32. module.exports = unset;