Get the number of items of an array, characters of a string or properties of an object; undefined otherwise.
npm i @davebaol/length-of --save
var lengthOf = require('@davebaol/length-of');
lengthOf({a: 'a', b: 'b'});
//=> 2
lengthOf('length-of');
//=> 9
lengthOf(['foo', 'bar']);
//=> 2
lengthOf(123);
//=> undefined
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Install dev dependencies.
npm i -d && npm test
MIT © Davide Sessi