From f217451fc537951797c7dd0c9f19c195df50bede Mon Sep 17 00:00:00 2001 From: Felix Hayashi Date: Tue, 3 Nov 2015 23:47:47 +0100 Subject: [PATCH] Replacing count's function body with Object.keys see #2046 --- core/modules/utils/utils.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js index f7f8340a7..b490c45f0 100644 --- a/core/modules/utils/utils.js +++ b/core/modules/utils/utils.js @@ -35,9 +35,7 @@ exports.trim = function(str) { Return the number of keys in an object */ exports.count = function(object) { - var s = 0; - $tw.utils.each(object,function() {s++;}); - return s; + return Object.keys(object || {}).length; }; /* @@ -645,4 +643,4 @@ exports.tagToCssSelector = function(tagName) { }; -})(); \ No newline at end of file +})();