phane-tech-object-utils
v1.0.2
Published
Pure JavaScript array utility functions
Downloads
178
Maintainers
Keywords
Readme
📦 Kotipalli Phaneendra Kumar - Object Utilities
A 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.
✨ Highlights
- 🧱 Object validation helpers
- 🔑 Safe key and value access
- 📏 Object inspection utilities
- 🧬 Deep cloning support
- 🧪 Extensive Jest test coverage
- ⚡ Zero dependencies
📦 Installation
npm install phane-tech-object-utils🚀 Import
import {
isEmptyObject,
getObjectKeys,
getObjectValues,
hasObjectKey,
deepCloneObject
} from "phane-tech-object-utils";📚 API Reference
🧱 isEmptyObject(value)
Checks whether an object has no own enumerable properties.
isEmptyObject({}); // true
isEmptyObject({ a: 1 }); // false🔑 getObjectKeys(value)
Returns an array of an object’s own enumerable keys.
getObjectKeys({ a: 1, b: 2 }); // ["a", "b"]📦 getObjectValues(value)
Returns an array of an object’s own enumerable values.
getObjectValues({ a: 1, b: 2 }); // [1, 2]🔍 hasObjectKey(object, key)
Checks whether an object has a specified own property.
hasObjectKey({ a: 1 }, "a"); // true
hasObjectKey({ a: 1 }, "b"); // false🧬 deepCloneObject(value)
Creates a deep clone of an object using JSON serialization.
const obj = { a: 1, b: { c: 2 } };
const copy = deepCloneObject(obj);
copy.b.c = 99;
console.log(obj.b.c); // 2📄 License
MIT
🔗 Links
- 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
