Skip to content

Latest commit

 

History

History
58 lines (48 loc) · 1.95 KB

unset.md

File metadata and controls

58 lines (48 loc) · 1.95 KB

Object Agent

A javascript library for working with objects

npm build coverage deps size vulnerabilities license


unset(object, path) ⇒ object

Deletes a property from a nested object.

Returns: object - The mutated object.

Param Type Description
object object The object to mutate.
path string Dot delimited string.

Example

import { unset } from 'object-agent';

const thing = {
    a: [{
        b: 'c'
    }, {
        b: 'd'
    }]
};

unset(thing, ['a.1.b']);
console.log(thing);
// => {
//    a: [{ b: 'c' }, {}]
//}