forked from 0x2620/oxjs
make Ox.reverse() work for arrays
This commit is contained in:
parent
1576ba4c48
commit
1f7796b0f8
4 changed files with 18 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue