Mailer project rwritten:
[mailer.git] / js / core-common.js
index 77d08f337b936b3b17662e5ad2c32b3c9f0c0927..2fab4bc2a788025939ee33816624e871e8896efd 100644 (file)
@@ -34,7 +34,7 @@ function in_array (needle, heystack) {
        // Check all elements
        for (var i = 0; i < heystack.length; i++) {
                // Is the element found?
-               if (heystack[i] == needle) {
+               if (heystack[i] === needle) {
                        // Found it and abort
                        isInArray = true;
                        break;
@@ -56,3 +56,18 @@ function decodeUrlEncoding (content) {
        // Return it
        return decoded;
 }
+
+// "Getter" for total elements in given object
+function getTotalCountFromObject (object) {
+       // Default is zero
+       var total = 0;
+
+       // Start looping
+       $.each(object, function (i, j) {
+               // Add it
+               total++;
+       });
+
+       // Return total
+       return total;
+}