https://github.com/davebaol/length-of
Get the number of items of an array, characters of a string or properties of an object; undefined otherwise
https://github.com/davebaol/length-of
array length object string
Last synced: 6 months ago
JSON representation
Get the number of items of an array, characters of a string or properties of an object; undefined otherwise
- Host: GitHub
- URL: https://github.com/davebaol/length-of
- Owner: davebaol
- License: mit
- Created: 2019-04-25T09:40:12.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-25T20:27:25.000Z (over 6 years ago)
- Last Synced: 2025-04-13T09:13:55.404Z (6 months ago)
- Topics: array, length, object, string
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# length-of
[](https://badge.fury.io/js/%40davebaol%2Flength-of) [](https://travis-ci.org/davebaol/length-of) [](https://codecov.io/github/davebaol/length-of) [](https://david-dm.org/davebaol/length-of) [](https://david-dm.org/davebaol/length-of?type=dev) [](https://opensource.org/licenses/MIT)
Get the number of items of an array, characters of a string or properties of an object; undefined otherwise.
## Install with npm
```bash
npm i @davebaol/length-of --save
```## Usage
```js
var lengthOf = require('@davebaol/length-of');lengthOf({a: 'a', b: 'b'});
//=> 2lengthOf('length-of');
//=> 9lengthOf(['foo', 'bar']);
//=> 2lengthOf(123);
//=> undefined
```## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/davebaol/length-of/issues)## Running tests
Install dev dependencies.```bash
npm i -d && npm test
```# License
MIT © Davide Sessi