Sha256: c2e1a7210df0b0a717be9450c439cf564e70f8f7ca99bde6e14bce4b9e0ff074

Contents?: true

Size: 1.36 KB

Versions: 38

Compression:

Stored size: 1.36 KB

Contents

"use strict";

exports.__esModule = true;

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

var _iterator2 = _interopRequireDefault(_iterator);

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

var _symbol2 = _interopRequireDefault(_symbol);

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

var _promise2 = _interopRequireDefault(_promise);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.default = function (inner, awaitWrap) {
  var iter = {},
      waiting = false;

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

  ;

  if (typeof _symbol2.default === "function" && _iterator2.default) {
    iter[_iterator2.default] = 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) {
      return pump("return", value);
    };
  }

  return iter;
};

Version data entries

38 entries across 38 versions & 9 rubygems

Version Path
immosquare-cleaner-0.1.60 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.59 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.58 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.57 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.56 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.55 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.54 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.53 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.52 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.51 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.50 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.49 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.48 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.47 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.46 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.45 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.44 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.43 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.42 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js
immosquare-cleaner-0.1.41 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js