Skip to content

andrefa/deep-property-set

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to deep-property-set 👋

Documentation Maintenance

Utility function responsible to replace properties on nested objects, without prior knowledge of object structure.

Install

npm install deep-property-set

Usage

const deepSet = require('deep-property-set').deepSet

// The source object to be modified
const obj = {
    a: 1,
    b: 2,
    c: {
        d: 3,
        b: 4
    }
};
// The name of the property which will be replaced
const property = 'b';
// The new value for the property aforementioned
const replacement = 'new-value';

// A new object with the mentioned property modified to the new value
const result = deepSet(obj, property, replacement);

result = {
    a: 1,
    b: 'new-value',
    c: {
        d: 3,
        b: 'new-value'
    }
};

Where

object - the source object

Author

👤 Andre Almeida

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2020 Andre Almeida. This project is MIT licensed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published