get-iterator-method.js 508 B

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