The source repository for regenerator-runtime can now be found at
https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime
This also removes the babel-regenerator-runtime package, now that the only
difference between it and regenerator-runtime has been resolved:
bc8d2d672c
30 lines
896 B
JavaScript
30 lines
896 B
JavaScript
/* eslint max-len: 0 */
|
|
|
|
if (global._babelPolyfill) {
|
|
throw new Error("only one instance of babel-polyfill is allowed");
|
|
}
|
|
global._babelPolyfill = true;
|
|
|
|
import "core-js/shim";
|
|
import "regenerator-runtime/runtime";
|
|
|
|
// Should be removed in the next major release:
|
|
|
|
import "core-js/fn/regexp/escape";
|
|
|
|
let DEFINE_PROPERTY = "defineProperty";
|
|
function define(O, key, value) {
|
|
O[key] || Object[DEFINE_PROPERTY](O, key, {
|
|
writable: true,
|
|
configurable: true,
|
|
value: value
|
|
});
|
|
}
|
|
|
|
define(String.prototype, "padLeft", "".padStart);
|
|
define(String.prototype, "padRight", "".padEnd);
|
|
|
|
"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(key) {
|
|
[][key] && define(Array, key, Function.call.bind([][key]));
|
|
});
|