Wondering what’s next for npm?Check out our public roadmap! »

    set-deep

    0.1.1 • Public • Published

    set-deep

    Helper for setting the value of a nested object property

    Install

    $ npm install set-deep

    Usage

    var set = require('set-deep')
     
    var target = {
        person: {
            address: {
                country: ''
            }
        }
    }
    set('person.address.country', target, 'France')
    //or
    set(['person', 'address', 'country'], target, 'France')
     
    //or
    var setCountry = set('person.address.country')
    setCountry(target, 'France')
     
    //or
    var setCountryOnTarget = set('person.address.country', target)
    setCountryOnTarget('UK')

    Tests

    $ make

    License

    MIT
    

    Install

    npm i set-deep

    DownloadsWeekly Downloads

    3

    Version

    0.1.1

    License

    MIT

    Last publish

    Collaborators

    • avatar