Sha256: 7694b7cb2e73b11d909f3896b3eec5ada4d0190b50bb762e6b0bf6adda2bdee7

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

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;
module.exports["default"] = module.exports, module.exports.__esModule = true;

Version data entries

4 entries across 3 versions & 2 rubygems

Version Path
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js