ox.js cleanup and fixes
This commit is contained in:
parent
195cff5bfe
commit
cb8685a340
1 changed files with 5 additions and 3 deletions
|
@ -243,11 +243,13 @@ Ox.sort = function(arr, fn) {
|
||||||
Ox.unique <f> Returns an array without duplicate values
|
Ox.unique <f> Returns an array without duplicate values
|
||||||
> Ox.unique([1, 2, 3, 2, 1])
|
> Ox.unique([1, 2, 3, 2, 1])
|
||||||
[1, 2, 3]
|
[1, 2, 3]
|
||||||
|
> Ox.unique([NaN, NaN])
|
||||||
|
[]
|
||||||
@*/
|
@*/
|
||||||
|
|
||||||
Ox.unique = function(arr) {
|
Ox.unique = function(arr) {
|
||||||
return Ox.map(arr, function(val) {
|
return Ox.map(arr, function(val, i) {
|
||||||
return arr.indexOf(val) == arr.lastIndexOf(val) ? val : false;
|
return arr.indexOf(val) == i ? val : null;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3902,7 +3904,7 @@ Ox.serialize <f> Parses an object into query parameters
|
||||||
> Ox.serialize({a: 1, b: 2, c: 3})
|
> Ox.serialize({a: 1, b: 2, c: 3})
|
||||||
'a=1&b=2&c=3'
|
'a=1&b=2&c=3'
|
||||||
> Ox.serialize({a: 1, b: 2.3, c: [4, 5]})
|
> Ox.serialize({a: 1, b: 2.3, c: [4, 5]})
|
||||||
'a=1&b=2.3&c=3,4,5'
|
'a=1&b=2.3&c=4,5'
|
||||||
@*/
|
@*/
|
||||||
Ox.serialize = function(obj) {
|
Ox.serialize = function(obj) {
|
||||||
var arr = [];
|
var arr = [];
|
||||||
|
|
Loading…
Reference in a new issue