Sha256: 2ca225dbc766355a4f3340bb075686ccda775792b7ea09abeff1b64488302e97

Contents?: true

Size: 1.19 KB

Versions: 7

Compression:

Stored size: 1.19 KB

Contents

var _Symbol$iterator = require("../core-js/symbol/iterator");

var _Symbol = require("../core-js/symbol");

var _Promise = require("../core-js/promise");

function _asyncGeneratorDelegate(inner, awaitWrap) {
  var iter = {},
      waiting = false;

  function pump(key, value) {
    waiting = true;
    value = new _Promise(function (resolve) {
      resolve(inner[key](value));
    });
    return {
      done: false,
      value: awaitWrap(value)
    };
  }

  ;

  if (typeof _Symbol === "function" && _Symbol$iterator) {
    iter[_Symbol$iterator] = function () {
      return this;
    };
  }

  iter.next = function (value) {
    if (waiting) {
      waiting = false;
      return value;
    }

    return pump("next", value);
  };

  if (typeof inner["throw"] === "function") {
    iter["throw"] = function (value) {
      if (waiting) {
        waiting = false;
        throw value;
      }

      return pump("throw", value);
    };
  }

  if (typeof inner["return"] === "function") {
    iter["return"] = function (value) {
      if (waiting) {
        waiting = false;
        return value;
      }

      return pump("return", value);
    };
  }

  return iter;
}

module.exports = _asyncGeneratorDelegate;

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
condenser-0.3 lib/condenser/processors/node_modules/@babel/runtime-corejs3/helpers/asyncGeneratorDelegate.js
condenser-0.2 lib/condenser/processors/node_modules/@babel/runtime-corejs3/helpers/asyncGeneratorDelegate.js
condenser-0.1 lib/condenser/processors/node_modules/@babel/runtime-corejs3/helpers/asyncGeneratorDelegate.js
condenser-0.0.12 lib/condenser/processors/node_modules/@babel/runtime-corejs3/helpers/asyncGeneratorDelegate.js
condenser-0.0.11 lib/condenser/processors/node_modules/@babel/runtime-corejs3/helpers/asyncGeneratorDelegate.js
condenser-0.0.10 lib/condenser/processors/node_modules/@babel/runtime-corejs3/helpers/asyncGeneratorDelegate.js
condenser-0.0.9 lib/condenser/processors/node_modules/@babel/runtime-corejs3/helpers/asyncGeneratorDelegate.js