import { getObjValue, isObject } from 'obj-array-helpers';
const myObject = {
name: 'John',
age: 30,
address: {
city: 'New York',
country: 'USA'
}
};
console.log(getObjValue(myObject, 'name')); // Output: John
console.log(getObjValue(myObject, 'age')); // Output: 30
console.log(getObjValue(myObject, 'email', 'N/A')); // Output: N/A (since 'email' key does not exist)
console.log(getObjValue(myObject, 'address')); // Output: { city: 'New York', country: 'USA' }
console.log(isObject(myObject)); // Output: true
console.log(isObject(42)); // Output: false
console.log(isObject('Hello')); // Output: false
console.log(isObject(null)); // Output: false
console.log(isObject([1, 2, 3])); // Output: false
object-array-helpers
1.0.1 • Public • PublishedPackage Sidebar
Install
npm i object-array-helpers
Weekly Downloads
1
Version
1.0.1
License
ISC
Unpacked Size
15 kB
Total Files
5