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

Loving my wife, my sons, and my work. Building codeship by day and packtracker by night, otherwise you can probably find me outside 🧗🏻‍♂️🏕