node.js 372 B

123456789101112
  1. 'use strict';
  2. // this should only run in node >= 13.2, so it
  3. // does not need any of the intense fallbacks that old node/browsers do
  4. var $iterator = Symbol.iterator;
  5. module.exports = function getIterator(iterable) {
  6. // alternatively, `iterable[$iterator]?.()`
  7. if (iterable != null && typeof iterable[$iterator] !== 'undefined') {
  8. return iterable[$iterator]();
  9. }
  10. };