X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2Feuphorik.js;h=8c138417761f4cbf428c186a5b511a3211bc31df;hp=28cba42f848e6c73878136ecf6803c7894c8c2a8;hb=ff1b8889e37bdecb354caa1f330a3ce2cfa82519;hpb=deff7a2f11dca2b300b258d1e93d71e3b2e34c84 diff --git a/js/euphorik.js b/js/euphorik.js index 28cba42..8c13841 100755 --- a/js/euphorik.js +++ b/js/euphorik.js @@ -67,16 +67,22 @@ var euphorik = {} Object.prototype.each = function(f) { for (var k in this) { if (this.hasOwnProperty(k)) { - f(k, this[k]) + f(k, this[k]); } } -} +}; Array.prototype.each = function(f) { for (var i = 0; i < this.length; i++) { - f(i, this[i]) + f(i, this[i]); } -} +}; + +Array.prototype.map = function(f) { + for (var i = 0; i < this.length; i++) { + this[i] = f(this[i]) + } +}; String.prototype.trim = function() { return jQuery.trim(this) // anciennement : this.replace(/^\s+|\s+$/g, "");