MCPcopy
hub / github.com/esamattis/underscore.string / boolMatch

Function boolMatch

toBoolean.js:3–12  ·  view source on GitHub ↗
(s, matchers)

Source from the content-addressed store, hash-verified

1var trim = require('./trim');
2
3function 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
14module.exports = function toBoolean(str, trueValues, falseValues) {
15 if (typeof str === 'number') str = '' + str;

Callers 1

toBoolean.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…