Function isTruthy

  • Check if given input is truthy (so not 0, NaN, "", false, or nullish).

    Example

    isTruthy(42); // true
    isTruthy(true); // true
    isTruthy(false); // false
    isTruthy(0); // false

    Type Parameters

    • Input

    Parameters

    • input: Input | Truthy<ReadOnly<Input>>

      Value to check.

    Returns input is Truthy<ReadOnly<Input>>

    Returns true if truthy, false otherwise.