@babel/runtime-corejs2
Advanced tools
Comparing version 7.15.4 to 7.16.0
@@ -5,17 +5,80 @@ var _Symbol = require("@babel/runtime-corejs2/core-js/symbol"); | ||
var _Promise = require("@babel/runtime-corejs2/core-js/promise"); | ||
function _asyncIterator(iterable) { | ||
var method; | ||
var method, | ||
async, | ||
sync, | ||
retry = 2; | ||
if (typeof _Symbol !== "undefined") { | ||
if (_Symbol.asyncIterator) method = iterable[_Symbol.asyncIterator]; | ||
if (method == null && _Symbol$iterator) method = iterable[_Symbol$iterator]; | ||
async = _Symbol.asyncIterator; | ||
sync = _Symbol$iterator; | ||
} | ||
if (method == null) method = iterable["@@asyncIterator"]; | ||
if (method == null) method = iterable["@@iterator"]; | ||
if (method == null) throw new TypeError("Object is not async iterable"); | ||
return method.call(iterable); | ||
while (retry--) { | ||
if (async && (method = iterable[async]) != null) { | ||
return method.call(iterable); | ||
} | ||
if (sync && (method = iterable[sync]) != null) { | ||
return new AsyncFromSyncIterator(method.call(iterable)); | ||
} | ||
async = "@@asyncIterator"; | ||
sync = "@@iterator"; | ||
} | ||
throw new TypeError("Object is not async iterable"); | ||
} | ||
function AsyncFromSyncIterator(s) { | ||
AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { | ||
this.s = s; | ||
this.n = s.next; | ||
}; | ||
AsyncFromSyncIterator.prototype = { | ||
s: null, | ||
n: null, | ||
next: function next() { | ||
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); | ||
}, | ||
"return": function _return(value) { | ||
var ret = this.s["return"]; | ||
if (ret === undefined) { | ||
return _Promise.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
} | ||
return AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); | ||
}, | ||
"throw": function _throw(value) { | ||
var thr = this.s["return"]; | ||
if (thr === undefined) return _Promise.reject(value); | ||
return AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); | ||
} | ||
}; | ||
function AsyncFromSyncIteratorContinuation(r) { | ||
if (Object(r) !== r) { | ||
return _Promise.reject(new TypeError(r + " is not an object.")); | ||
} | ||
var done = r.done; | ||
return _Promise.resolve(r.value).then(function (value) { | ||
return { | ||
value: value, | ||
done: done | ||
}; | ||
}); | ||
} | ||
return new AsyncFromSyncIterator(s); | ||
} | ||
module.exports = _asyncIterator; | ||
module.exports["default"] = module.exports, module.exports.__esModule = true; |
import _Symbol from "@babel/runtime-corejs2/core-js/symbol"; | ||
import _Symbol$iterator from "@babel/runtime-corejs2/core-js/symbol/iterator"; | ||
import _Promise from "@babel/runtime-corejs2/core-js/promise"; | ||
export default function _asyncIterator(iterable) { | ||
var method; | ||
var method, | ||
async, | ||
sync, | ||
retry = 2; | ||
if (typeof _Symbol !== "undefined") { | ||
if (_Symbol.asyncIterator) method = iterable[_Symbol.asyncIterator]; | ||
if (method == null && _Symbol$iterator) method = iterable[_Symbol$iterator]; | ||
async = _Symbol.asyncIterator; | ||
sync = _Symbol$iterator; | ||
} | ||
if (method == null) method = iterable["@@asyncIterator"]; | ||
if (method == null) method = iterable["@@iterator"]; | ||
if (method == null) throw new TypeError("Object is not async iterable"); | ||
return method.call(iterable); | ||
while (retry--) { | ||
if (async && (method = iterable[async]) != null) { | ||
return method.call(iterable); | ||
} | ||
if (sync && (method = iterable[sync]) != null) { | ||
return new AsyncFromSyncIterator(method.call(iterable)); | ||
} | ||
async = "@@asyncIterator"; | ||
sync = "@@iterator"; | ||
} | ||
throw new TypeError("Object is not async iterable"); | ||
} | ||
function AsyncFromSyncIterator(s) { | ||
AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { | ||
this.s = s; | ||
this.n = s.next; | ||
}; | ||
AsyncFromSyncIterator.prototype = { | ||
s: null, | ||
n: null, | ||
next: function next() { | ||
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); | ||
}, | ||
"return": function _return(value) { | ||
var ret = this.s["return"]; | ||
if (ret === undefined) { | ||
return _Promise.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
} | ||
return AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); | ||
}, | ||
"throw": function _throw(value) { | ||
var thr = this.s["return"]; | ||
if (thr === undefined) return _Promise.reject(value); | ||
return AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); | ||
} | ||
}; | ||
function AsyncFromSyncIteratorContinuation(r) { | ||
if (Object(r) !== r) { | ||
return _Promise.reject(new TypeError(r + " is not an object.")); | ||
} | ||
var done = r.done; | ||
return _Promise.resolve(r.value).then(function (value) { | ||
return { | ||
value: value, | ||
done: done | ||
}; | ||
}); | ||
} | ||
return new AsyncFromSyncIterator(s); | ||
} |
{ | ||
"name": "@babel/runtime-corejs2", | ||
"version": "7.15.4", | ||
"version": "7.16.0", | ||
"description": "babel's modular runtime helpers with core-js@2 polyfilling", | ||
@@ -21,2 +21,11 @@ "license": "MIT", | ||
"exports": { | ||
"./helpers/asyncIterator": [ | ||
{ | ||
"node": "./helpers/asyncIterator.js", | ||
"import": "./helpers/esm/asyncIterator.js", | ||
"default": "./helpers/asyncIterator.js" | ||
}, | ||
"./helpers/asyncIterator.js" | ||
], | ||
"./helpers/esm/asyncIterator": "./helpers/esm/asyncIterator.js", | ||
"./helpers/jsx": [ | ||
@@ -58,11 +67,2 @@ { | ||
"./helpers/esm/wrapRegExp": "./helpers/esm/wrapRegExp.js", | ||
"./helpers/asyncIterator": [ | ||
{ | ||
"node": "./helpers/asyncIterator.js", | ||
"import": "./helpers/esm/asyncIterator.js", | ||
"default": "./helpers/asyncIterator.js" | ||
}, | ||
"./helpers/asyncIterator.js" | ||
], | ||
"./helpers/esm/asyncIterator": "./helpers/esm/asyncIterator.js", | ||
"./helpers/AwaitValue": [ | ||
@@ -69,0 +69,0 @@ { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
179156
289
3201