Function assertPrune

  • Prune, erase superfluous properties, with type assertion.

    typia.misc.assertPrune() is a combination function of assert and prune. Therefore, it removes every superfluous properties from the input object including nested objects, with type assertion.

    In such reason, when input value is not matched with the type T, it throws an TypeGuardError or custom error generated by errorFactory. Otherwise, there's no problem on the input value, its every superfluous properties would be removed, including nested objects.

    Type Parameters

    • T

      Type of the input value

    Parameters

    • input: T

      Target instance to assert and prune

    • OptionalerrorFactory: ((props: TypeGuardError.IProps) => Error)

      Custom error factory. Default is TypeGuardError

    Returns T

    Jeongho Nam - https://github.com/samchon

  • Prune, erase superfluous properties, with type assertion.

    typia.misc.assertPrune() is a combination function of assert and prune. Therefore, it removes every superfluous properties from the input object including nested objects, with type assertion.

    In such reason, when input value is not matched with the type T, it throws an TypeGuardError or custom error generated by errorFactory. Otherwise, there's no problem on the input value, its every superfluous properties would be removed, including nested objects.

    Type Parameters

    • T

      Type of the input value

    Parameters

    • input: unknown

      Target instance to assert and prune

    • OptionalerrorFactory: ((props: TypeGuardError.IProps) => Error)

      Custom error factory. Default is TypeGuardError

    Returns T

    Jeongho Nam - https://github.com/samchon