Generate test functions using the RegExp prototype.

  var testForA = RegExp.prototype.test.bind(/[aA]/);
  // function () { [native code] }

  testForA('hello');
  // false

  testForA('hella');
  // true

  ['hello', 'hella', 'holla'].filter(testForA);
  // ['hella', 'holla']

Oh the lengths we'll go to avoid typing 'function'

Jonathan D. Johnson

I love my wife, my sons, and my work.
Senior Software Engineer @ Codeship.
Ruby/JavaScript. I like to be outside.