(s, matchers)
| 1 | var trim = require('./trim'); |
| 2 | |
| 3 | function boolMatch(s, matchers) { |
| 4 | var i, matcher, down = s.toLowerCase(); |
| 5 | matchers = [].concat(matchers); |
| 6 | for (i = 0; i < matchers.length; i += 1) { |
| 7 | matcher = matchers[i]; |
| 8 | if (!matcher) continue; |
| 9 | if (matcher.test && matcher.test(s)) return true; |
| 10 | if (matcher.toLowerCase() === down) return true; |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | module.exports = function toBoolean(str, trueValues, falseValues) { |
| 15 | if (typeof str === 'number') str = '' + str; |
no outgoing calls
no test coverage detected
searching dependent graphs…