diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-03 15:35:00 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-03 15:35:00 +0200 |
commit | de98e0b232509d5f40c135d540a70e415272ff85 (patch) | |
tree | a79222a5b58484ab3b80d18efcaaa7ccc4769b33 /node_modules/core-js/modules/$.fix-re-wks.js | |
parent | e0c9d480a73fa629c1e4a47d3e721f1d2d345406 (diff) |
node_modules
Diffstat (limited to 'node_modules/core-js/modules/$.fix-re-wks.js')
-rw-r--r-- | node_modules/core-js/modules/$.fix-re-wks.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/node_modules/core-js/modules/$.fix-re-wks.js b/node_modules/core-js/modules/$.fix-re-wks.js new file mode 100644 index 000000000..3597a8985 --- /dev/null +++ b/node_modules/core-js/modules/$.fix-re-wks.js @@ -0,0 +1,26 @@ +'use strict'; +var hide = require('./$.hide') + , redefine = require('./$.redefine') + , fails = require('./$.fails') + , defined = require('./$.defined') + , wks = require('./$.wks'); + +module.exports = function(KEY, length, exec){ + var SYMBOL = wks(KEY) + , original = ''[KEY]; + if(fails(function(){ + var O = {}; + O[SYMBOL] = function(){ return 7; }; + return ''[KEY](O) != 7; + })){ + redefine(String.prototype, KEY, exec(defined, SYMBOL, original)); + hide(RegExp.prototype, SYMBOL, length == 2 + // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) + // 21.2.5.11 RegExp.prototype[@@split](string, limit) + ? function(string, arg){ return original.call(string, this, arg); } + // 21.2.5.6 RegExp.prototype[@@match](string) + // 21.2.5.9 RegExp.prototype[@@search](string) + : function(string){ return original.call(string, this); } + ); + } +};
\ No newline at end of file |