import assert from 'assert' ; export const mergeRegex = ( ... regexes ) : RegExp => { assert ( regexes . length , 'mergeRegex: regular expression array should not be empty.' ) ; const sources = regexes . map ( regex => regex instanceof RegExp ? regex . source : regex ) ; return new RegExp ( sources . join ( '|' ) ) ; } ;