Pure JavaScript array utility functions
npm install phane-tech-object-utilsA lightweight, dependency-free JavaScript module that provides safe and predictable object utility functions.
These helpers make it easy to inspect, validate, and clone objects while handling edge cases such as null, undefined, arrays, and invalid inputs.
Designed to be minimal, consistent, and well-tested for both Node.js and browser environments.
---
- ๐งฑ Object validation helpers
- ๐ Safe key and value access
- ๐ Object inspection utilities
- ๐งฌ Deep cloning support
- ๐งช Extensive Jest test coverage
- โก Zero dependencies
---
``bash`
npm install phane-tech-object-utils
---
`js`
import {
isEmptyObject,
getObjectKeys,
getObjectValues,
hasObjectKey,
deepCloneObject
} from "phane-tech-object-utils";
---
Checks whether an object has no own enumerable properties.
`js`
isEmptyObject({}); // true
isEmptyObject({ a: 1 }); // false
Returns an array of an objectโs own enumerable keys.
`js`
getObjectKeys({ a: 1, b: 2 }); // ["a", "b"]
Returns an array of an objectโs own enumerable values.
`js`
getObjectValues({ a: 1, b: 2 }); // [1, 2]
Checks whether an object has a specified own property.
`js`
hasObjectKey({ a: 1 }, "a"); // true
hasObjectKey({ a: 1 }, "b"); // false
Creates a deep clone of an object using JSON serialization.
`js``
const obj = { a: 1, b: { c: 2 } };
const copy = deepCloneObject(obj);
copy.b.c = 99;
console.log(obj.b.c); // 2
---
MIT
---
- GitHub Repository: https://github.com/phane-tech/js-object-utils
- Demo / Documentation: https://phane-tech.github.io/js-object-utils/module-ObjectUtils.html
- Unit Test Cases Reports: https://phane-tech.github.io/js-object-utils/unit-test-report.html