Function validateOr

  • Run several validations in the same string, true if any is true.

    Example

    validateOr([])("1"); // false

    validateOr([
    item => item === "1",
    item => parseInt(item as string, 10) === 1,
    ])("1"); // true

    validateOr([
    item => item === "1",
    item => parseInt(item as string, 10) === 2,
    ])("1"); // true

    validateOr([
    item => item === "2",
    item => parseInt(item as string, 10) === 2,
    ])("1"); // false

    Returns

    Curried function with validations in context.

    Parameters

    • validations: readonly ((value: unknown) => boolean)[]

      List of validations.

    Returns ((value: unknown) => boolean)

      • (value: unknown): boolean
      • Parameters

        • value: unknown

        Returns boolean