Permalink
Browse files

pickOne should not return if result is false

  • Loading branch information...
1 parent 2d1bc8f commit 5bce572a2fea8420fef1d1b08a2eae1ee180aaf3 @marcuswestin committed May 25, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 pickOne.js
View
@@ -6,12 +6,12 @@ module.exports = function pickOne(items, fn) {
if (isArray(items)) {
for (var i=0; i<items.length; i++) {
result = fn(items[i], i)
- if (result != null) { return result }
+ if (result != null && result != false) { return result }
}
} else {
for (var key in items) {
result = fn(items[key], key)
- if (result != null) { return result }
+ if (result != null && result != false) { return result }
}
}
return null

0 comments on commit 5bce572

Please sign in to comment.