1
0

is-iterable.js 503 B

123456789101112131415161718
  1. 'use strict';
  2. var iteratorSymbol = require('es6-symbol').iterator
  3. , Iterator = require('../');
  4. module.exports = function (t, a) {
  5. var iterator;
  6. a(t(), false, "Undefined");
  7. a(t(123), false, "Number");
  8. a(t({}), false, "Plain object");
  9. a(t({ length: 0 }), false, "Array-like");
  10. iterator = {};
  11. iterator[iteratorSymbol] = function () { return new Iterator([]); };
  12. a(t(iterator), true, "Iterator");
  13. a(t([]), true, "Array");
  14. a(t('foo'), true, "String");
  15. a(t(''), true, "Empty string");
  16. };