object-common.js 146 B

1234567
  1. Object.size = function(obj) {
  2. let size = 0, key;
  3. for (key in obj) {
  4. if (obj.hasOwnProperty(key)) size++;
  5. }
  6. return size;
  7. };