Sha256: 8557b836097be01091100a53b492494178a59a037142a9e7b1702830eb9b744b
Contents?: true
Size: 784 Bytes
Versions: 33
Compression:
Stored size: 784 Bytes
Contents
"use strict"; // StackOverflow: How to get object length // http://stackoverflow.com/a/24457767/4209080 //noinspection JSUnusedGlobalSymbols var fCalcObjSize = function (obj) { var count = 0; if (typeof obj == "object") { if (Object.keys) { count = Object.keys(obj).length; } else { //noinspection JSUnresolvedVariable if (window._) { //noinspection JSUnresolvedVariable count = _.keys(obj).length; } else if (window.$) { count = $.map(obj, function () { return 1; }).length; } else { for (var key in obj) if (obj.hasOwnProperty(key)) count++; } } } return count; };
Version data entries
33 entries across 33 versions & 1 rubygems