Node-Red configuration
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.

iterate-simple.js 381B

123456789101112
  1. 'use strict';
  2. var call = require('../internals/function-call');
  3. module.exports = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) {
  4. var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator;
  5. var next = record.next;
  6. var step, result;
  7. while (!(step = call(next, iterator)).done) {
  8. result = fn(step.value);
  9. if (result !== undefined) return result;
  10. }
  11. };