Function hasIteratorSymbol

  • Check if given object has the Symbol.iterator symbol.

    Example

    hasIteratorSymbol({ [Symbol.iterator]() {} }); // true
    hasIteratorSymbol({ bar: "bar" }); // false

    Returns

    true when given object has the Symbol.iterator symbol, false otherwise.

    Type Parameters

    • Actual extends object

    Parameters

    • object: Actual | Readonly<Record<typeof iterator, unknown>>

    Returns object is Readonly<Record<typeof iterator, unknown>>