]> git.r.bdr.sh - rbdr/dotfiles/blob
38230fd85a2101b55fb94497007b25938d30829b
[rbdr/dotfiles] /
1 'use strict';
2
3 var isString = require('es5-ext/string/is-string')
4 , ArrayIterator = require('./array')
5 , StringIterator = require('./string')
6 , iterable = require('./valid-iterable')
7 , iteratorSymbol = require('es6-symbol').iterator;
8
9 module.exports = function (obj) {
10 if (typeof iterable(obj)[iteratorSymbol] === 'function') return obj[iteratorSymbol]();
11 if (isString(obj)) return new StringIterator(obj);
12 return new ArrayIterator(obj);
13 };