diff options
author | portix <none@none> | 2012-08-21 14:57:34 +0200 |
---|---|---|
committer | portix <none@none> | 2012-08-21 14:57:34 +0200 |
commit | cf3566fbe3df4583b54409c188362b7dd4b40c9b (patch) | |
tree | a607ba8c529dcb2d6dbc8d63a7996b60673ffcec /scripts | |
parent | 1b71e3d1bf57a002fb9faaa5b0d964d412e0b7e8 (diff) | |
download | dwb-cf3566fbe3df4583b54409c188362b7dd4b40c9b.zip |
Implementing Array.fastIndexOf; adding dwb-js-manpage
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/util.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/lib/util.js b/scripts/lib/util.js index c6836f72..59601686 100644 --- a/scripts/lib/util.js +++ b/scripts/lib/util.js @@ -21,4 +21,15 @@ } }); } + if (Array.prototype.fastIndexOf === undefined) { + Object.defineProperty(Array.prototype, "fastIndexOf", { + value : function (v) { + for (var i=0, l=this.length; i<l; ++i) { + if (this[i] == v) + return i; + } + return -1; + } + }); + } })(); |