1
0
Fork 0
forked from 0x2620/oxjs

temporary fix for parseKeyboard bug

This commit is contained in:
Rolux 2010-07-05 18:52:12 +02:00
commit 4363c8dac1
3 changed files with 198 additions and 136 deletions

View file

@ -182,6 +182,28 @@ Ox.filter = function(arr, fn) {
return ret;
};
Ox.getObjectById = function(arr, id) {
var ret = null;
Ox.each(arr, function(i, v) {
if (v.id == id) {
ret = v;
return false;
}
});
return ret;
};
Ox.getPositionById = function(arr, id) {
var ret = -1;
Ox.each(arr, function(i, v) {
if (v.id == id) {
ret = i;
return false;
}
});
return ret;
};
Ox.keys = function(obj) {
/*
>>> Ox.keys({"a": 1, "b": 2, "c": 3})
@ -321,7 +343,7 @@ Ox.shuffle = function(arr) {
Ox.some = function(obj, fn) {
/*
Ox.some() forks for arrays, objects and strings, unlike [].some()
Ox.some() works for arrays, objects and strings, unlike [].some()
>>> Ox.some([2, 1, 0], function(i, v) { return i == v; })
true
>>> Ox.some({a: 1, b: 2, c: 3}, function(v) { return v == 1; })