object-lib is a utility library for JavaScript that provides a collection of functions for robust object manipulation, particularly focusing on recursive operations, alignment, cloning, deep comparison, and merging. The current stable version is 5.2.4, with frequent patch and minor releases, indicating active maintenance and continuous development. Key differentiators include its integration with `object-scan` syntax for declarative pathing in functions like `clone` and `Merge`, enabling powerful and flexible data transformations. It also offers unique features like `jsonSmartParse` for gracefully handling malformed JSON, often encountered from LLM outputs, and `SafeProxy` for creating proxy objects that enforce strict property access, throwing errors for non-existent keys instead of returning `undefined`. The library is designed for modern Node.js environments, requiring Node.js version 20 or higher since v5.0.0, ensuring compatibility with contemporary JavaScript features.
npm install object-libVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates key features including object alignment, deep cloning with selective referencing, smart merging based on identifiers, using `SafeProxy` for strict property access, and parsing malformed JSON with `jsonSmartParse`.
Upgrade your Node.js environment to version 20 or higher. For projects that cannot upgrade Node.js, consider staying on `object-lib` v4.x.
Ensure all property accesses on `SafeProxy` objects are valid or wrapped in `try...catch` blocks. Alternatively, use `Reflect.has()` or `in` operator to check for property existence before access.
Thoroughly review the `object-scan` documentation and test your `Merge` configurations with diverse data sets to ensure the desired merging logic is applied correctly.
For inputs where strict JSON adherence is critical, use `JSON.parse` with appropriate error handling. Use `jsonSmartParse` only when expecting and needing to recover from common JSON formatting errors.
Migrate your module to ESM by using `import` statements and ensuring your `package.json` specifies `"type": "module"` or files end with `.mjs`.
Ensure all accessed properties exist on the `SafeProxy` object, or wrap access in `try...catch` blocks, or use `Reflect.has()` to check for property existence before attempting to read it.
Upgrade your Node.js installation to version 20 or a newer compatible version.
No dependency data recorded yet.