core-js
Version:
Standard library
13 lines (12 loc) • 421 B
JavaScript
// Should throw an error on invalid iterator
// https://issues.chromium.org/issues/336839115
module.exports = function (methodName, argument) {
// eslint-disable-next-line es/no-iterator -- required for testing
var method = typeof Iterator == 'function' && Iterator.prototype[methodName];
if (method) try {
method.call({ next: null }, argument).next();
} catch (error) {
return true;
}
};
;