Set nested properties on JavaScript objects using dot notation with high performance and extensive options.
Set-value is a JavaScript utility library that enables setting deeply nested properties on objects using dot-notation paths. It solves the problem of safely and efficiently creating or modifying complex object structures without manual property checking and object creation. The library handles edge cases like escaping and custom separators while maintaining high performance.
JavaScript and Node.js developers working with configuration objects, state management, data transformation pipelines, or any code requiring deep object manipulation.
Developers choose set-value for its reliability, extensive options for path handling, and proven performance advantages over alternatives like lodash.set or dot-prop. It provides a focused API for a common task with robust escape mechanisms and merge capabilities.
Set nested properties on an object using dot-notation.
Extensive benchmarks show set-value outperforms competitors like lodash.set and dot-prop in deep, medium, and shallow property sets, making it the fastest choice for nested object manipulation.
Supports custom separators, path escaping with backslashes, and preserves paths with '/' by default, enabling versatile use cases such as handling URL properties without unwanted splitting.
Offers a merge option to shallowly merge values with Object.assign or allow custom deep merge functions, preventing overwrites and facilitating incremental object updates.
Handles complex scenarios like dots in property names through escaping and provides options for custom split functions, ensuring correctness where other libraries fail.
Directly modifies the input object, which can introduce side effects and is incompatible with immutable data patterns or functional programming practices that require purity.
Bracket notation support was removed in v3.0.0 and now requires a custom split function, adding complexity for users who rely on that syntax without extra configuration.
The README warns of a critical bug fixed only in v3.0.1, indicating past stability issues that necessitate careful version management and may affect trust in older releases.
Deep diffs two objects, including nested structures of arrays and objects, and returns the difference. ❄️
Stringify an object/array like JSON.stringify just without all the double-quotes
Use property paths (`a.b.c`) get a nested value from an object.
[DEPRECATED] Recursive Object.assign()
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.