isIterable()
Syntax
function isIterable(object: unknown): object is Iterable<unknown>
Type guard that checks whether a value is an Iterable
.
Parameters | |
object
|
An object whose type isn’t known. |
Example
import { isIterable } from 'potence';
let variable: unknown;
if (isIterable(variable)) {
// Can now use for ... of loop here
for (const element of variable) {
...
}
}
Remarks
See Iterable
.