diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js index a529369c9..becb70e2d 100644 --- a/core/modules/utils/utils.js +++ b/core/modules/utils/utils.js @@ -12,6 +12,15 @@ Various static utility functions. /*global $tw: false */ "use strict"; +/* +Return the number of keys in an object +*/ +exports.count = function(object) { + var s = 0; + $tw.utils.each(object,function() {s++;}); + return s; +}; + /* Push entries onto an array, removing them first if they already exist in the array array: array to modify