add Array.isArray

This commit is contained in:
rolux 2012-05-25 17:45:01 +02:00
parent 2f5a99a88f
commit b2f392a2b5

View file

@ -123,6 +123,19 @@ Ox.fallback.indexOf = function(value) {
return ret;
};
/*@
Ox.fallback.isArray <f> see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
> Ox.fallback.isArray([])
true
> Ox.fallback.isArray((function() { return arguments; }()))
false
> Ox.fallback.isArray({0: 0, length: 1})
false
@*/
Ox.fallback.isArray = function(value) {
return Object.prototype.toString.call(value) == '[object Array]';
};
/*@
Ox.fallback.lastIndexOf <f> see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
> Ox.fallback.lastIndexOf.call([1, 2, 3, 2, 1], 2)
@ -265,6 +278,7 @@ Ox.fallback.trim = function() {
var method, object;
for (method in Ox.fallback) {
object = method == 'bind' ? Function.prototype
: method == 'isArray' ? Array
: method == 'keys' ? Object
: method == 'trim' ? String.prototype
: Array.prototype;