1
0
Fork 0
forked from 0x2620/oxjs

check browser version

This commit is contained in:
rolux 2011-04-23 17:51:58 +02:00
commit a2dfb0367d
2 changed files with 39 additions and 32 deletions

View file

@ -329,24 +329,6 @@ Ox.filter = function(obj, fn) {
return ret;
};
Ox.flatten = function(arr) {
/*
>>> Ox.flatten([1, [2, [3], 4], 5])
[1, 2, 3, 4, 5]
*/
var ret = [];
arr.forEach(function(v) {
if (Ox.isArray(v)) {
Ox.flatten(v).forEach(function(v) {
ret.push(v);
});
} else {
ret.push(v);
}
});
return ret;
}
Ox.find = function(arr, str) {
/*
returns an array with two arrays as elements:
@ -367,6 +349,24 @@ Ox.find = function(arr, str) {
return ret;
};
Ox.flatten = function(arr) {
/*
>>> Ox.flatten([1, [2, [3], 4], 5])
[1, 2, 3, 4, 5]
*/
var ret = [];
arr.forEach(function(v) {
if (Ox.isArray(v)) {
Ox.flatten(v).forEach(function(v) {
ret.push(v);
});
} else {
ret.push(v);
}
});
return ret;
}
Ox.forEach = function(obj, fn) {
/*
Ox.forEach() works for arrays, objects and strings,