function joinRegex(stringArray) {
  return stringArray.length > 1 ?
    `(${stringArray.join('|')})` :
    stringArray[0];
}
/**
 * Returns a string joined with a pipe (|) and surrounded by parentheses for regex.
 * If there is only one string, it does not surround the string with parentheses.
 *
 * @param {String[]} stringArray
 * @return String
 */
Returns a string joined with a pipe (|) and surrounded by parentheses for regex.
If there is only one string, it does not surround the string with parentheses.

@param {String[]} stringArray
@return String
Returns a string joined with a pipe ( | ) and surrounded by parentheses for regex . If there is only one string it does not surround the string with parentheses . @param { String [] } stringArray @return String
function joinRegex(stringArray) {
  return stringArray.length > 1 ?
    `(${stringArray.join('|')})` :
    stringArray[0];
}
function joinRegex ( stringArray ) { return stringArray . length > 1 ? ` ${ stringArray . join ( '|' ) } ` : stringArray [ 0 ] ; }
Returns a string joined with a pipe (|) and surrounded by parentheses for regex.
Returns a string joined with a pipe ( | ) and surrounded by parentheses for regex .