js-utils-deep is a lightweight JavaScript utility package providing a focused set of functions for deep, recursive manipulation of objects. It includes `recursiveOmit`, which removes null, empty string, and undefined values from all nested levels of an object; `deepExtend`, designed for deeply merging properties from a source object into a target object; and `diffObject`, which identifies key-value differences between two objects, including nested structures. Currently at version 1.1.4, the library appears to be in a maintenance phase, offering stable and tested functionalities without frequent updates. Its primary differentiator is its straightforward API for common deep object tasks, providing essential recursive utilities without the added complexity of larger, more generalized utility libraries.
npm install js-utils-deepVerified import paths — ran on the pinned version, not inferred.
Demonstrates the core functionalities of `js-utils-deep`: `recursiveOmit` to clean deeply nested objects, `deepExtend` to merge objects recursively, and `diffObject` to find differences, highlighting their usage and mutation behavior.
Before calling `deepExtend(obj1, obj2)` or `recursiveOmit(obj)`, create a deep clone of `obj1` or `obj` (e.g., `const clonedObj = JSON.parse(JSON.stringify(obj));`) and pass the clone to the function.
Ensure objects passed to deep utility functions do not contain circular references. Pre-process objects to remove or break cycles if necessary, or use a library designed to handle circular references explicitly.
If empty strings need to be preserved, consider pre-processing your object to replace empty strings with a placeholder or use a custom recursive function for omission.
Inspect the object structure for circular references. Refactor your object to avoid them, or preprocess the object to break cycles (e.g., by setting circular references to `null`) before passing it to `js-utils-deep` functions.
Ensure all arguments passed to `js-utils-deep` functions, especially the target or source objects, are valid JavaScript objects (non-null, non-undefined).
Ensure that intermediate objects exist in the target where `deepExtend` is expected to merge. For example, if `source.a.b` exists, but `target.a` is `undefined`, `deepExtend` might fail. Pre-initialize empty objects for paths if necessary, or ensure your target object's structure is compatible with the source.
No dependency data recorded yet.