MCPcopy Create free account
hub / github.com/microsoft/SandDance / AsyncFromSyncIterator

Function AsyncFromSyncIterator

docs/app/js/sanddance-app.js:54441–54472  ·  view source on GitHub ↗
(s1)

Source from the content-addressed store, hash-verified

54439}
54440exports.default = _asyncIterator;
54441function AsyncFromSyncIterator(s1) {
54442 function AsyncFromSyncIteratorContinuation(r) {
54443 if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
54444 var done = r.done;
54445 return Promise.resolve(r.value).then(function(value) {
54446 return {
54447 value: value,
54448 done: done
54449 };
54450 });
54451 }
54452 return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) {
54453 this.s = s, this.n = s.next;
54454 }, AsyncFromSyncIterator.prototype = {
54455 s: null,
54456 n: null,
54457 next: function next() {
54458 return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
54459 },
54460 "return": function _return(value) {
54461 var ret = this.s["return"];
54462 return void 0 === ret ? Promise.resolve({
54463 value: value,
54464 done: !0
54465 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));
54466 },
54467 "throw": function _throw(value) {
54468 var thr = this.s["return"];
54469 return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
54470 }
54471 }, new AsyncFromSyncIterator(s1);
54472}
54473
54474},{"@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"fJwci":[function(require,module,exports) {
54475var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected