is-iterable.js 507 B

12345678910111213141516
  1. "use strict";
  2. var isArguments = require("es5-ext/function/is-arguments")
  3. , isValue = require("es5-ext/object/is-value")
  4. , isString = require("es5-ext/string/is-string");
  5. var iteratorSymbol = require("es6-symbol").iterator
  6. , isArray = Array.isArray;
  7. module.exports = function (value) {
  8. if (!isValue(value)) return false;
  9. if (isArray(value)) return true;
  10. if (isString(value)) return true;
  11. if (isArguments(value)) return true;
  12. return typeof value[iteratorSymbol] === "function";
  13. };