diff --git a/source/Ox/js/Array.js b/source/Ox/js/Array.js index ee36619a..da243f4f 100644 --- a/source/Ox/js/Array.js +++ b/source/Ox/js/Array.js @@ -399,7 +399,7 @@ Ox.compact Removes `null` or `undefined` values from an array @*/ Ox.compact = function(array) { return array.filter(function(value) { - return !Ox.isNull(value) && !Ox.isUndefined(value); + return value != null; }); }; @@ -439,9 +439,7 @@ Ox.flatten = function(array) { var ret = []; array.forEach(function(value) { if (Ox.isArray(value)) { - Ox.flatten(value).forEach(function(value) { - ret.push(value); - }); + ret = ret.concat(Ox.flatten(value)); } else { ret.push(value); }