versions/0.9.0/app/orga-bundlev2.js
/**
 * Copies a regex object while preserving extended data and augmenting with `XRegExp.prototype`
 * properties. The copy has a fresh `lastIndex` property (set to zero). Allows adding and removing
 * flags g and y while copying the regex.
 *
 * @private
 * @param {RegExp} regex Regex to copy.
 * @param {Object} [options] Options object with optional properties:
 *   - `addG` {Boolean} Add flag g while copying the regex.
 *   - `addY` {Boolean} Add flag y while copying the regex.
 *   - `removeG` {Boolean} Remove flag g while copying the regex.
 *   - `removeY` {Boolean} Remove flag y while copying the regex.
 *   - `isInternalOnly` {Boolean} Whether the copied regex will be used only for internal
 *     operations, and never exposed to users. For internal-only regexes, we can improve perf by
 *     skipping some operations like attaching `XRegExp.prototype` properties.
 *   - `source` {String} Overrides `<regex>.source`, for special cases.
 * @returns {RegExp} Copy of the provided regex, possibly with modified flags.
 */
Copies a regex object while preserving extended data and augmenting with `XRegExp.prototype`
properties. The copy has a fresh `lastIndex` property (set to zero). Allows adding and removing
flags g and y while copying the regex.

@private
@param {RegExp} regex Regex to copy.
@param {Object} [options] Options object with optional properties:
- `addG` {Boolean} Add flag g while copying the regex.
- `addY` {Boolean} Add flag y while copying the regex.
- `removeG` {Boolean} Remove flag g while copying the regex.
- `removeY` {Boolean} Remove flag y while copying the regex.
- `isInternalOnly` {Boolean} Whether the copied regex will be used only for internal
operations, and never exposed to users. For internal-only regexes, we can improve perf by
skipping some operations like attaching `XRegExp.prototype` properties.
- `source` {String} Overrides `.source`, for special cases.
@returns {RegExp} Copy of the provided regex, possibly with modified flags.
Copies a regex object while preserving extended data and augmenting with ` XRegExp . prototype ` properties . The copy has a fresh ` lastIndex ` property ( set to zero ) . Allows adding and removing flags g and y while copying the regex . @private @param { RegExp } regex Regex to copy . @param { Object } [ options ] Options object with optional properties : - ` addG ` { Boolean } Add flag g while copying the regex . - ` addY ` { Boolean } Add flag y while copying the regex . - ` removeG ` { Boolean } Remove flag g while copying the regex . - ` removeY ` { Boolean } Remove flag y while copying the regex . - ` isInternalOnly ` { Boolean } Whether the copied regex will be used only for internal operations and never exposed to users . For internal - only regexes we can improve perf by skipping some operations like attaching ` XRegExp . prototype ` properties . - ` source ` { String } Overrides ` . source ` for special cases . @returns { RegExp } Copy of the provided regex possibly with modified flags .
function copyRegex(regex, options) {
  var _context2;
  if (!XRegExp.isRegExp(regex)) {
    throw new TypeError('Type RegExp expected');
  }
  var xData = regex[REGEX_DATA] || {};
  var flags = getNativeFlags(regex);
  var flagsToAdd = '';
  var flagsToRemove = '';
  var xregexpSource = null;
  var xregexpFlags = null;
  options = options || {};
  if (options.removeG) {
    flagsToRemove += 'g';
  }
  if (options.removeY) {
    flagsToRemove += 'y';
  }
  if (flagsToRemove) {
    flags = nativ.replace.call(flags, new RegExp("[".concat(flagsToRemove, "]+"), 'g'), '');
  }
  if (options.addG) {
    flagsToAdd += 'g';
  }
  if (options.addY) {
    flagsToAdd += 'y';
  }
  if (flagsToAdd) {
    flags = clipDuplicates(flags + flagsToAdd);
  }
  if (!options.isInternalOnly) {
    if (xData.source !== undefined) {
      xregexpSource = xData.source;
    } 
    if ((0, _flags["default"])(xData) != null) {
      xregexpFlags = flagsToAdd ? clipDuplicates((0, _flags["default"])(xData) + flagsToAdd) : (0, _flags["default"])(xData);
    }
  } 
  regex = augment(new RegExp(options.source || regex.source, flags), hasNamedCapture(regex) ? (0, _slice["default"])(_context2 = xData.captureNames).call(_context2, 0) : null, xregexpSource, xregexpFlags, options.isInternalOnly);
  return regex;
}
function copyRegex ( regex , options ) { var _context2 ; if ( ! XRegExp . isRegExp ( regex ) ) { throw new TypeError ( 'Type RegExp expected' ) ; } var xData = regex [ REGEX_DATA ] || { } ; var flags = getNativeFlags ( regex ) ; var flagsToAdd = '' ; var flagsToRemove = '' ; var xregexpSource = null ; var xregexpFlags = null ; options = options || { } ; if ( options . removeG ) { flagsToRemove += 'g' ; } if ( options . removeY ) { flagsToRemove += 'y' ; } if ( flagsToRemove ) { flags = nativ . replace . call ( flags , new RegExp ( "[" . concat ( flagsToRemove , "]+" ) , 'g' ) , '' ) ; } if ( options . addG ) { flagsToAdd += 'g' ; } if ( options . addY ) { flagsToAdd += 'y' ; } if ( flagsToAdd ) { flags = clipDuplicates ( flags + flagsToAdd ) ; } if ( ! options . isInternalOnly ) { if ( xData . source !== undefined ) { xregexpSource = xData . source ; } if ( ( 0 , _flags [ "default" ] ) ( xData ) != null ) { xregexpFlags = flagsToAdd ? clipDuplicates ( ( 0 , _flags [ "default" ] ) ( xData ) + flagsToAdd ) : ( 0 , _flags [ "default" ] ) ( xData ) ; } } regex = augment ( new RegExp ( options . source || regex . source , flags ) , hasNamedCapture ( regex ) ? ( 0 , _slice [ "default" ] ) ( _context2 = xData . captureNames ) . call ( _context2 , 0 ) : null , xregexpSource , xregexpFlags , options . isInternalOnly ) ; return regex ; }
Copies a regex object while preserving extended data and augmenting with `XRegExp.prototype`
 properties.
Copies a regex object while preserving extended data and augmenting with ` XRegExp . prototype ` properties .
// null or undefined; don't want to add to `flags` if the previous value was null, since // that indicates we're not tracking original precompilation flags // Flags are only added for non-internal regexes by `XRegExp.globalize`. Flags are never // removed for non-internal regexes, so don't need to handle it // Augment with `XRegExp.prototype` properties, but use the native `RegExp` constructor to avoid // searching for special tokens. That would be wrong for regexes constructed by `RegExp`, and // unnecessary for regexes constructed by `XRegExp` because the regex has already undergone the // translation to native regex syntax