function wrap(arr, sep, opts) {
  if (sep === '~') { sep = '-'; }
  var str = arr.join(sep);
  var pre = opts && opts.regexPrefix;

  // regex logical `or`
  if (sep === '|') {
    str = pre ? pre + str : str;
    str = '(' + str + ')';
  }

  // regex character class
  if (sep === '-') {
    str = (pre && pre === '^')
      ? pre + str
      : str;
    str = '[' + str + ']';
  }
  return [str];
}
function wrap(arr, sep, opts) {
  if (sep === '~') { sep = '-'; }
  var str = arr.join(sep);
  var pre = opts && opts.regexPrefix;

  // regex logical `or`
  if (sep === '|') {
    str = pre ? pre + str : str;
    str = '(' + str + ')';
  }

  // regex character class
  if (sep === '-') {
    str = (pre && pre === '^')
      ? pre + str
      : str;
    str = '[' + str + ']';
  }
  return [str];
}
function wrap ( arr , sep , opts ) { if ( sep === '~' ) { sep = '-' ; } var str = arr . join ( sep ) ; var pre = opts && opts . regexPrefix ; // regex logical `or` if ( sep === '|' ) { str = pre ? pre + str : str ; str = '(' + str + ')' ; } // regex character class if ( sep === '-' ) { str = ( pre && pre === '^' ) ? pre + str : str ; str = '[' + str + ']' ; } return [ str ] ; }
Wrap the string with the correct regex
syntax.
Wrap the string with the correct regex syntax .