lib/plugin.js
function regexpToGlobalRegexp(regexp) {
  let source = regexp instanceof RegExp ? regexp.source : regexp

  return new RegExp(source, 'g')
}
function regexpToGlobalRegexp(regexp) {
  let source = regexp instanceof RegExp ? regexp.source : regexp

  return new RegExp(source, 'g')
}
function regexpToGlobalRegexp ( regexp ) { let source = regexp instanceof RegExp ? regexp . source : regexp return new RegExp ( source , 'g' ) }
Newer javascript engines allow setting flags when passing existing regexp
to the RegExp constructor, until then, we extract the regexp source and
build a new object.

@param {RegExp|string} regexp The regexp to modify
@return {RegExp} The new regexp instance
Newer javascript engines allow setting flags when passing existing regexp to the RegExp constructor until then we extract the regexp source and build a new object .