lib/tools.js
function makeIter(iterable) {
    if (typeof iterable[iterSymbol] === 'function') {
        // passed argument can create iterators - create new one.
        return iterable[iterSymbol]();
    }

    if (!_isSubscriptable(iterable)) {
        throw Error('Unsupported argument type');
    }

    // passed argument can be indexed, eg. string, array, etc.
    // - create new iter object.
    var idx = -1;
    return {
        next: function() {
            return ++idx < iterable.length
                ? {done: false, value: iterable[idx]}
                : {done: true};
        }
    };
}
function makeIter(iterable) {
    if (typeof iterable[iterSymbol] === 'function') {
        // passed argument can create iterators - create new one.
        return iterable[iterSymbol]();
    }

    if (!_isSubscriptable(iterable)) {
        throw Error('Unsupported argument type');
    }

    // passed argument can be indexed, eg. string, array, etc.
    // - create new iter object.
    var idx = -1;
    return {
        next: function() {
            return ++idx < iterable.length
                ? {done: false, value: iterable[idx]}
                : {done: true};
        }
    };
}
function makeIter ( iterable ) { if ( typeof iterable [ iterSymbol ] === 'function' ) { // passed argument can create iterators - create new one. return iterable [ iterSymbol ] ( ) ; } if ( ! _isSubscriptable ( iterable ) ) { throw Error ( 'Unsupported argument type' ) ; } // passed argument can be indexed, eg. string, array, etc. // - create new iter object. var idx = - 1 ; return { next : function ( ) { return ++ idx < iterable . length ? { done : false , value : iterable [ idx ] } : { done : true } ; } } ; }
Makes a new iterator from iterable.

NOTE: an existing iterator can be passed to this function.

@param {Iterable|Array|String} iterable
@returns {Iterator}
Makes a new iterator from iterable .