Function isInstanceOf

  • Takes a constructor and checks if given input is an instance of it.

    Example

    const instanceOfArray = instanceOf(Array)

    instanceOfArray([]); // true
    instanceOfArray({}); // false

    Returns

    Returns a curried function with constructor in context.

    Type Parameters

    • Expected extends GenericConstructor<ReadOnlyArray<never>, unknown>

    Parameters

    • constructor: Expected

    Returns (<Actual>(input: Actual | InstanceType<Expected>) => input is InstanceType<Expected>)

      • <Actual>(input: Actual | InstanceType<Expected>): input is InstanceType<Expected>
      • Type Parameters

        • Actual = unknown

        Parameters

        • input: Actual | InstanceType<Expected>

        Returns input is InstanceType<Expected>