get-iterator-method.js 494 B

12345678910111213
  1. var classof = require('../internals/classof');
  2. var getMethod = require('../internals/get-method');
  3. var isNullOrUndefined = require('../internals/is-null-or-undefined');
  4. var Iterators = require('../internals/iterators');
  5. var wellKnownSymbol = require('../internals/well-known-symbol');
  6. var ITERATOR = wellKnownSymbol('iterator');
  7. module.exports = function (it) {
  8. if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR)
  9. || getMethod(it, '@@iterator')
  10. || Iterators[classof(it)];
  11. };