What is is-iterable?
The is-iterable npm package is a utility that allows you to check if a given value is iterable. This can be useful in various scenarios where you need to ensure that a value can be iterated over, such as in loops or when using spread operators.
Check if a value is iterable
This feature allows you to check if a given value is iterable. The code sample demonstrates checking various types of values, including arrays, strings, numbers, and objects.
const isIterable = require('is-iterable');
console.log(isIterable([1, 2, 3])); // true
console.log(isIterable('hello')); // true
console.log(isIterable(123)); // false
console.log(isIterable({})); // false