mirror of
https://github.com/github/codeql-action.git
synced 2025-12-28 02:00:12 +08:00
19 lines
475 B
JavaScript
19 lines
475 B
JavaScript
"use strict";
|
|
|
|
/**
|
|
* Returns `true` when the argument is an iterable, `false` otherwise
|
|
*
|
|
* @alias module:samsam.isIterable
|
|
* @param {*} val - A value to examine
|
|
* @returns {boolean} Returns `true` when the argument is an iterable, `false` otherwise
|
|
*/
|
|
function isIterable(val) {
|
|
// checks for null and undefined
|
|
if (typeof val !== "object") {
|
|
return false;
|
|
}
|
|
return typeof val[Symbol.iterator] === "function";
|
|
}
|
|
|
|
module.exports = isIterable;
|