不要怂,就是干,撸起袖子干!

Commit bdd9005d by Jan Aagaard Meier

Don't remove 0 in compactLite

1 parent dac4e1c8
Showing with 5 additions and 2 deletions
......@@ -30,6 +30,9 @@ var Utils = module.exports = {
return result
},
/*
* Returns an array with some falsy values removed. The values null, "", undefined and NaN are considered falsey.
*/
compactLite: function(array) {
var index = -1,
length = array ? array.length : 0,
......@@ -37,7 +40,7 @@ var Utils = module.exports = {
while (++index < length) {
var value = array[index];
if (typeof value === "boolean" || value) {
if (typeof value === "boolean" || value === 0 || value) {
result.push(value);
}
}
......@@ -214,7 +217,7 @@ var Utils = module.exports = {
}
}
return [text.join(' AND ')].concat(whereArgs)
return Utils._.compactLite([text.join(' AND ')].concat(whereArgs))
},
getWhereLogic: function(logic) {
switch (logic) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!