esnext.iterator.every.js 547 B

12345678910111213141516
  1. 'use strict';
  2. // https://github.com/tc39/proposal-iterator-helpers
  3. var $ = require('../internals/export');
  4. var iterate = require('../internals/iterate');
  5. var aCallable = require('../internals/a-callable');
  6. var anObject = require('../internals/an-object');
  7. $({ target: 'Iterator', proto: true, real: true, forced: true }, {
  8. every: function every(fn) {
  9. anObject(this);
  10. aCallable(fn);
  11. return !iterate(this, function (value, stop) {
  12. if (!fn(value)) return stop();
  13. }, { IS_ITERATOR: true, INTERRUPTED: true }).stopped;
  14. }
  15. });