add comment; remove separate Ox.toArray
This commit is contained in:
parent
d9b25c6fae
commit
84bfd1222e
1 changed files with 1 additions and 32 deletions
|
@ -556,6 +556,7 @@ Ox.makeArray <f> Wraps any non-array in an array.
|
|||
> Ox.makeArray(['foo'])
|
||||
['foo']
|
||||
@*/
|
||||
// FIXME: rename to toArray
|
||||
Ox.makeArray = function(value) {
|
||||
var ret, type = Ox.typeOf(value);
|
||||
if (type == 'arguments') {
|
||||
|
@ -738,38 +739,6 @@ Ox.range = function() {
|
|||
|
||||
}());
|
||||
|
||||
/*@
|
||||
Ox.toArray <f> Takes an array-like object and returns a true array
|
||||
(value) -> <a> True array
|
||||
value <*> Array-like object
|
||||
> (function() { return Ox.toArray(arguments); }('foo', 'bar'))
|
||||
['foo', 'bar']
|
||||
> Ox.toArray('foo')
|
||||
['f', 'o', 'o']
|
||||
> Ox.toArray({0: 'f', 1: 'o', 2: 'o', length: 3})
|
||||
['f', 'o', 'o']
|
||||
@*/
|
||||
Ox.toArray = function(collection) {
|
||||
return Ox.slice(collection);
|
||||
};
|
||||
try {
|
||||
Array.prototype.slice.call(document.getElementsByTagName('a'));
|
||||
} catch (error) {
|
||||
// Handle IE NodeLists
|
||||
Ox.toArray = function(collection) {
|
||||
var i, length, ret = [];
|
||||
try {
|
||||
ret = Ox.slice(collection);
|
||||
} catch (error) {
|
||||
length = collection.length;
|
||||
for (i = 0; i < length; i++) {
|
||||
ret[i] = collection[i];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
/*@
|
||||
Ox.unique <f> Removes duplicate values from an array
|
||||
(array) -> <a> Array without duplicate values
|
||||
|
|
Loading…
Reference in a new issue