added a function to count the number of fields of an object. popcorn-port
authorhamidouk
Tue, 29 Nov 2011 16:35:20 +0100
branchpopcorn-port
changeset 354 002c314cabbf
parent 353 21f3a1d501eb
child 355 d8df77c40676
added a function to count the number of fields of an object.
src/js/utils.js
--- a/src/js/utils.js	Tue Nov 29 15:47:46 2011 +0100
+++ b/src/js/utils.js	Tue Nov 29 16:35:20 2011 +0100
@@ -72,6 +72,17 @@
   return i3;
 };
 
+IriSP.countProperties = function(obj) {
+    var count = 0;
+
+    for(var prop in obj) {
+        if(obj.hasOwnProperty(prop))
+                ++count;
+    }
+
+    return count;
+};
+
 /* for ie compatibility
 if (Object.prototype.__defineGetter__&&!Object.defineProperty) {
    Object.defineProperty=function(obj,prop,desc) {