Ox.unique: for string argument, return string
This commit is contained in:
parent
7f8403d89f
commit
08e16d073c
1 changed files with 2 additions and 1 deletions
|
@ -765,9 +765,10 @@ Ox.unique <f> Removes duplicate values from an array
|
||||||
[1, 2, 3]
|
[1, 2, 3]
|
||||||
> Ox.unique([NaN, NaN])
|
> Ox.unique([NaN, NaN])
|
||||||
[]
|
[]
|
||||||
|
> Ox.unique('foo')
|
||||||
|
'fo'
|
||||||
@*/
|
@*/
|
||||||
Ox.unique = function(array) {
|
Ox.unique = function(array) {
|
||||||
array = Ox.slice(array);
|
|
||||||
return Ox.filter(array, function(value, index) {
|
return Ox.filter(array, function(value, index) {
|
||||||
return array.indexOf(value) == index;
|
return array.indexOf(value) == index;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue