multilineRegex.js 329 B

123456789101112
  1. /**
  2. * Build RegExp object from an array
  3. * of multiple/multi-line regexp parts
  4. *
  5. * @param {string[]} parts
  6. * @param {string} flags
  7. * @return {object} - RegExp object
  8. */
  9. export default function multilineRegexp(parts, flags) {
  10. var regexpAsStringLiteral = parts.join('');
  11. return new RegExp(regexpAsStringLiteral, flags);
  12. }