1
0
Fork 0
forked from 0x2620/oxjs
This commit is contained in:
j 2012-05-25 16:28:05 +00:00
commit eb9cd1e397
9 changed files with 34 additions and 9 deletions

View file

@ -456,10 +456,24 @@ Ox.shuffle = function(collection) {
Ox.slice <f> Alias for <code>Array.prototype.slice.call</code>
> (function() { return Ox.slice(arguments, 1, -1); }(1, 2, 3))
[2]
> (function() { return Ox.slice(arguments, 1); }(1, 2, 3))
[2, 3]
@*/
Ox.slice = function(value, start, stop) {
return Array.prototype.slice.call(value, start, stop);
};
//IE8 returns an empty array if undefined is passed as start, stop
//IE8 returns an array of nulls if a string is passed to Array.prototype.slice.call
if(Ox.slice([1]).length == 0 || Ox.slice('a')[0] == null) {
Ox.slice = function(value, start, stop) {
if(Ox.typeOf(value) == 'string')
value = value.split('')
return stop === void 0
? Array.prototype.slice.call(value, start)
: Array.prototype.slice.call(value, start, stop);
};
}
/*@
Ox.some <f> Tests if one or more elements of a collection meet a given condition