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.

call-with-safe-iteration-closing.js 393B

123456789101112
  1. 'use strict';
  2. var anObject = require('../internals/an-object');
  3. var iteratorClose = require('../internals/iterator-close');
  4. // call something on iterator step with safe closing on error
  5. module.exports = function (iterator, fn, value, ENTRIES) {
  6. try {
  7. return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
  8. } catch (error) {
  9. iteratorClose(iterator, 'throw', error);
  10. }
  11. };