npm.io
2.1.4 • Published 5 years ago

objlength

Licence
ISC
Version
2.1.4
Deps
0
Size
1 kB
Vulns
0
Weekly
0
Stars
1

objlength


You might wonder, for knowing the length of array, we can do like

const a= [1,2,3,4]
console.log(a.length); // Returns length of a

But for object, we can't do like the above way, and we have to suppose do like the below way

const a = {name: "ameer", age: 98}
Object.keys(a).length // Returns length of a

To make it easy, follow the below way

import objectLength from 'objlength';

let a = {name: "ameerr", age: 98}
console.log(objectLength(a)); //length of a

Keywords