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.
14 lines
652 B
14 lines
652 B
var global = require('../internals/global'); |
|
var call = require('../internals/function-call'); |
|
var aCallable = require('../internals/a-callable'); |
|
var anObject = require('../internals/an-object'); |
|
var tryToString = require('../internals/try-to-string'); |
|
var getIteratorMethod = require('../internals/get-iterator-method'); |
|
|
|
var TypeError = global.TypeError; |
|
|
|
module.exports = function (argument, usingIterator) { |
|
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; |
|
if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument)); |
|
throw TypeError(tryToString(argument) + ' is not iterable'); |
|
};
|
|
|