Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

esnext.async-iterator.as-indexed-pairs.js 849B

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. // https://github.com/tc39/proposal-iterator-helpers
  3. var $ = require('../internals/export');
  4. var anObject = require('../internals/an-object');
  5. var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy');
  6. var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg, Promise) {
  7. var state = this;
  8. var iterator = state.iterator;
  9. return Promise.resolve(anObject(state.next.call(iterator, arg))).then(function (step) {
  10. if (anObject(step).done) {
  11. state.done = true;
  12. return { done: true, value: undefined };
  13. }
  14. return { done: false, value: [state.index++, step.value] };
  15. });
  16. });
  17. $({ target: 'AsyncIterator', proto: true, real: true }, {
  18. asIndexedPairs: function asIndexedPairs() {
  19. return new AsyncIteratorProxy({
  20. iterator: anObject(this),
  21. index: 0
  22. });
  23. }
  24. });