esnext.iterator.every.js 517 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 aFunction = require('../internals/a-function');
  6. var anObject = require('../internals/an-object');
  7. $({ target: 'Iterator', proto: true, real: true }, {
  8. every: function every(fn) {
  9. anObject(this);
  10. aFunction(fn);
  11. return !iterate(this, function (value) {
  12. if (!fn(value)) return iterate.stop();
  13. }, undefined, false, true).stopped;
  14. }
  15. });