ox.js cleanup and fixes

This commit is contained in:
rlx 2011-08-23 21:54:38 +00:00
parent 195cff5bfe
commit cb8685a340

View file

@ -243,11 +243,13 @@ Ox.sort = function(arr, fn) {
Ox.unique <f> Returns an array without duplicate values
> Ox.unique([1, 2, 3, 2, 1])
[1, 2, 3]
> Ox.unique([NaN, NaN])
[]
@*/
Ox.unique = function(arr) {
return Ox.map(arr, function(val) {
return arr.indexOf(val) == arr.lastIndexOf(val) ? val : false;
return Ox.map(arr, function(val, i) {
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})
'a=1&b=2&c=3'
> 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) {
var arr = [];