size.js 252 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 import isArrayLike from './_isArrayLike.js'; import keys from './keys.js'; // Return the number of elements in a collection. export default function size(obj) { if (obj == null) return 0; return isArrayLike(obj) ? obj.length : keys(obj).length; }