Skip to main content

unset

_.unset(path, object) # Ⓢ [Ⓣ][1] Ⓝ

Removes the property at path of object.




Since​

4.0.0

Arguments​

  1. path (Array|string): The path of the property to unset.
  2. object (Object): The object to modify.

Returns​

(boolean): Returns true if the property is deleted, else false.

Example​

var object = { 'a': [{ 'b': { 'c': 7 } }] };
_.unset('a[0].b.c', object);
// => true

// => { 'a': [{ 'b': {} }] };

_.unset(['a', '0', 'b', 'c'], object);
// => true

// => { 'a': [{ 'b': {} }] };