package.cjs.size.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of underscore Show documentation
Show all versions of underscore Show documentation
JavaScript's functional programming helper library.
The newest version!
var _isArrayLike = require('./_isArrayLike.js');
var keys = require('./keys.js');
// Return the number of elements in a collection.
function size(obj) {
if (obj == null) return 0;
return _isArrayLike(obj) ? obj.length : keys(obj).length;
}
module.exports = size;