For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /reference/predicate/isIterable.md.

isIterable es-toolkit

Checks if a value is iterable.

const result = isIterable(value);

Usage

isIterable(value)

Use isIterable to check whether a value implements the iterable protocol — that is, whether it has a Symbol.iterator method. Arrays, strings, Set, Map, typed arrays, and generators are iterable; plain objects, null, and undefined are not.

import { isIterable } from 'es-toolkit/predicate';

// Iterable values
console.log(isIterable([1, 2, 3])); // true
console.log(isIterable('abc')); // true
console.log(isIterable(new Set([1, 2, 3]))); // true
console.log(isIterable(new Map())); // true

// Non-iterable values
console.log(isIterable({ a: 1 })); // false
console.log(isIterable(123)); // false
console.log(isIterable(null)); // false

It can also be used as a type guard in TypeScript.

function collect(value: unknown): unknown[] {
  // Inside this branch, `value` is narrowed to `Iterable<unknown>`
  if (isIterable(value)) {
    return [...value];
  }
  return [];
}

Parameters

valueunknownrequired

The value to check.

Returns

Returns true if the value is iterable, false otherwise.

value is Iterable<unknown>
Source: es-toolkit

Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.