doipjs/node_modules/@sinonjs/samsam/lib/create-matcher/is-iterable.js
Yarmo Mackenbach e996bc8023 Initial commit
2020-10-23 22:35:53 +02:00

16 lines
360 B
JavaScript

"use strict";
var typeOf = require("@sinonjs/commons").typeOf;
/**
* Returns `true` for iterables
*
* @private
* @param {*} value A value to examine
* @returns {boolean} Returns `true` when `value` looks like an iterable
*/
function isIterable(value) {
return Boolean(value) && typeOf(value.forEach) === "function";
}
module.exports = isIterable;