index.js
function toBoolFunction(selector, condition) {
  if (arguments.length == 2) {
    selector = toBoolFunction(selector);
    condition = toBoolFunction(condition);
    return function () {
      return condition(selector.apply(this, arguments));
    };
  } else {
    condition = selector;
  }
  var alternate = false;
  try {
    switch (type(condition)) {
      case 'regexp':
        alternate = regexpToFunction(condition);
        break;
      case 'string':
        alternate = stringToFunction(condition);
        break;
      case 'function':
        alternate = condition;
        break;
      case 'object':
        alternate = objectToFunction(condition);
        break;
    }
  } catch (ex) {
    //ignore things that aren't valid functions
  }
  return function (val) {
    return (val === condition) ||
      (alternate && alternate.apply(this, arguments));
  }
}
function toBoolFunction(selector, condition) {
  if (arguments.length == 2) {
    selector = toBoolFunction(selector);
    condition = toBoolFunction(condition);
    return function () {
      return condition(selector.apply(this, arguments));
    };
  } else {
    condition = selector;
  }
  var alternate = false;
  try {
    switch (type(condition)) {
      case 'regexp':
        alternate = regexpToFunction(condition);
        break;
      case 'string':
        alternate = stringToFunction(condition);
        break;
      case 'function':
        alternate = condition;
        break;
      case 'object':
        alternate = objectToFunction(condition);
        break;
    }
  } catch (ex) {
    //ignore things that aren't valid functions
  }
  return function (val) {
    return (val === condition) ||
      (alternate && alternate.apply(this, arguments));
  }
}
function toBoolFunction ( selector , condition ) { if ( arguments . length == 2 ) { selector = toBoolFunction ( selector ) ; condition = toBoolFunction ( condition ) ; return function ( ) { return condition ( selector . apply ( this , arguments ) ) ; } ; } else { condition = selector ; } var alternate = false ; try { switch ( type ( condition ) ) { case 'regexp' : alternate = regexpToFunction ( condition ) ; break ; case 'string' : alternate = stringToFunction ( condition ) ; break ; case 'function' : alternate = condition ; break ; case 'object' : alternate = objectToFunction ( condition ) ; break ; } } catch ( ex ) { //ignore things that aren't valid functions } return function ( val ) { return ( val === condition ) || ( alternate && alternate . apply ( this , arguments ) ) ; } }
Convert various possible things into a match function

@param  {Any} [selector]
@param  {Any} condition
@return {Function}
Convert various possible things into a match function