1
0
Fork 0
forked from 0x2620/oxjs

make Ox.reverse() work for arrays

This commit is contained in:
rolux 2012-04-02 23:11:56 +02:00
commit 1f7796b0f8
4 changed files with 18 additions and 12 deletions

View file

@ -516,6 +516,19 @@ Ox.min = function(col) {
return Math.min.apply(Math, Ox.values(col));
};
/*@
Ox.reverse <f> Reverses an array or string
> Ox.reverse([1, 2, 3])
[3, 2, 1]
> Ox.reverse('foobar')
'raboof'
@*/
Ox.reverse = function(col) {
return Ox.isArray(col)
? Ox.clone(col).reverse()
: col.toString().split('').reverse().join('');
};
/*@
Ox.setPropertyOnce <f> Sets a property once
Given a array of objects, each of which has a property with a boolean