diff --git a/index.js b/index.js index ce2c8b9..fc5cde9 100644 --- a/index.js +++ b/index.js @@ -88,13 +88,20 @@ module.exports = function kindOf(val) { if (type === '[object Symbol]') { return 'symbol'; } + if (type === '[object Map Iterator]') { return 'mapiterator'; } if (type === '[object Set Iterator]') { return 'setiterator'; } - + if (type === '[object String Iterator]') { + return 'stringiterator'; + } + if (type === '[object Array Iterator]') { + return 'arrayiterator'; + } + // typed arrays if (type === '[object Int8Array]') { return 'int8array'; diff --git a/test/es6/index.js b/test/es6/index.js index 8b927b6..e6f4eab 100644 --- a/test/es6/index.js +++ b/test/es6/index.js @@ -62,15 +62,22 @@ module.exports = function() { }); it('should work for Set Iterator', function() { - var set = new Set().values(); - assert.equal(kindOf(set), 'setiterator'); + var SetValuesIterator = new Set().values(); + assert.equal(kindOf(SetValuesIterator), 'setiterator'); }); - it('should work for Map Iterator', function() { - var map = new Map().values(); - assert.equal(kindOf(map), 'mapiterator'); - }); - + var MapValuesIterator = new Map().values(); + assert.equal(kindOf(MapValuesIterator), 'mapiterator'); + }); + it('should work for Array Iterator', function() { + var ArrayEntriesIterator = [].entries(); + assert.equal(kindOf(ArrayEntriesIterator), 'arrayiterator'); + }) + it('should work for String Iterator', function() { + var StringCharIterator = ''[Symbol.iterator](); + assert.equal(kindOf(StringCharIterator), 'stringiterator'); + }) + it('should work for Symbol', function() { assert.equal(kindOf(Symbol('foo')), 'symbol'); assert.equal(kindOf(Symbol.prototype), 'symbol');