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
obj-array-helpers![This package contains built-in TypeScript declarations TypeScript icon, indicating that this package has built-in type declarations](https://static-production.npmjs.com/255a118f56f5346b97e56325a1217a16.svg)
1.0.6 • Public • Published Readme
Keywords
nonePackage Sidebar
Install
npm i obj-array-helpers
Weekly Downloads
1
Version
1.0.6
License
ISC
Unpacked Size
14.8 kB
Total Files
5