wallet-core/node_modules/es6-iterator/is-iterable.js

17 lines
507 B
JavaScript
Raw Normal View History

2017-12-10 21:51:33 +01:00
"use strict";
2017-08-14 05:01:11 +02:00
2017-12-10 21:51:33 +01:00
var isArguments = require("es5-ext/function/is-arguments")
, isValue = require("es5-ext/object/is-value")
, isString = require("es5-ext/string/is-string");
2017-08-14 05:01:11 +02:00
2017-12-10 21:51:33 +01:00
var iteratorSymbol = require("es6-symbol").iterator
, isArray = Array.isArray;
2017-08-14 05:01:11 +02:00
module.exports = function (value) {
2017-12-10 21:51:33 +01:00
if (!isValue(value)) return false;
2017-08-14 05:01:11 +02:00
if (isArray(value)) return true;
if (isString(value)) return true;
if (isArguments(value)) return true;
2017-12-10 21:51:33 +01:00
return typeof value[iteratorSymbol] === "function";
2017-08-14 05:01:11 +02:00
};