Sha256: 8ce23ff17ef116fe742f8aedb2276a600b7563101beeb5f736d38270806f0c26

Contents?: true

Size: 1.03 KB

Versions: 36

Compression:

Stored size: 1.03 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;

Version data entries

36 entries across 36 versions & 5 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-5.0.7 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-5.0.6 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-5.0.5 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-5.0.4 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-5.0.3 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-5.0.2 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-5.0.1 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-4.3.5 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-5.0.0 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-4.3.4 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-4.3.3 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-4.3.2 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-4.3.1 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-4.3 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-4.2.3 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
tang-0.2.1 spec/tang_app/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-4.2.2 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-4.2.1 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
trusty-cms-4.2 node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js