object-count

0.0.1 • Public • Published

Object count

Count the number of properties in an object, or return the number of items in an array. It doesn't look up in the prototype chain.

Installation

npm install object-count

How to use

Require object-count:

var count = require("object-count");

Use it with an object:

var anObject = {
  "property1": "with",
  "property2": "some",
  "property3": "data"
};
 
count(anObject); // 3

It also works with an array:

var anArray = ["with", "some", "data"];
 
count(anArray); // 3

LICENSE

MIT

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i object-count

    Weekly Downloads

    27

    Version

    0.0.1

    License

    none

    Last publish

    Collaborators

    • podefr