Sha256: 184a955abfed13ca70775d21a8b2c5ab3c5f28749c7abb605b2b5fc29004703e

Contents?: true

Size: 1.36 KB

Versions: 17

Compression:

Stored size: 1.36 KB

Contents

var $        = require('./$')
  , global   = require('./$.global')
  , isRegExp = require('./$.is-regexp')
  , $flags   = require('./$.flags')
  , $RegExp  = global.RegExp
  , Base     = $RegExp
  , proto    = $RegExp.prototype
  , re1      = /a/g
  , re2      = /a/g
  // "new" creates a new object, old webkit buggy here
  , CORRECT_NEW = new $RegExp(re1) !== re1;

if(require('./$.descriptors') && (!CORRECT_NEW || require('./$.fails')(function(){
  re2[require('./$.wks')('match')] = false;
  // RegExp constructor can alter flags and IsRegExp works correct with @@match
  return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
}))){
  $RegExp = function RegExp(p, f){
    var piRE = isRegExp(p)
      , fiU  = f === undefined;
    return !(this instanceof $RegExp) && piRE && p.constructor === $RegExp && fiU ? p
      : CORRECT_NEW
        ? new Base(piRE && !fiU ? p.source : p, f)
        : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f);
  };
  $.each.call($.getNames(Base), function(key){
    key in $RegExp || $.setDesc($RegExp, key, {
      configurable: true,
      get: function(){ return Base[key]; },
      set: function(it){ Base[key] = it; }
    });
  });
  proto.constructor = $RegExp;
  $RegExp.prototype = proto;
  require('./$.redefine')(global, 'RegExp', $RegExp);
}

require('./$.set-species')('RegExp');

Version data entries

17 entries across 17 versions & 7 rubygems

Version Path
ilog-0.4.1 node_modules/core-js/modules/es6.regexp.constructor.js
ilog-0.4.0 node_modules/core-js/modules/es6.regexp.constructor.js
ilog-0.3.3 node_modules/core-js/modules/es6.regexp.constructor.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/fbjs/node_modules/core-js/modules/es6.regexp.constructor.js
locomotivecms-3.4.0 app/javascript/node_modules/fbjs/node_modules/core-js/modules/es6.regexp.constructor.js
cortex-0.1.3 spec/dummy/node_modules/fbjs/node_modules/core-js/modules/es6.regexp.constructor.js
lanes-0.8.0 node_modules/core-js/modules/es6.regexp.constructor.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/core-js/modules/es6.regexp.constructor.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/core-js/modules/es6.regexp.constructor.js
babel-schmooze-sprockets-0.1.3 node_modules/core-js/modules/es6.regexp.constructor.js
babel-schmooze-sprockets-0.1.2 node_modules/core-js/modules/es6.regexp.constructor.js
babel-schmooze-sprockets-0.1.1 node_modules/core-js/modules/es6.regexp.constructor.js
babel-schmooze-sprockets-0.1.0 node_modules/core-js/modules/es6.regexp.constructor.js
babel-schmooze-sprockets-0.1.0.alpha.3 node_modules/core-js/modules/es6.regexp.constructor.js
babel-schmooze-sprockets-0.1.0.alpha.2 node_modules/core-js/modules/es6.regexp.constructor.js
es6_tilt-0.1.2 test/dummy/node_modules/core-js/modules/es6.regexp.constructor.js
es6_tilt-0.1.1 test/dummy/node_modules/core-js/modules/es6.regexp.constructor.js