Function equals

  • Tests equality between a value and its type.

    Tests a parametric value type and returns whether it's equivalent to the type T or not. If the parametric value is matched with the type T and there's not any superfluous property that is not listed on the type T, true value would be returned. Otherwise, the parametric value is not following the type T or some superfluous property exists, false value would be returned.

    If what you want is not just knowing whether the parametric value is following the type T or not, but throwing an exception with detailed reason, you can choose assertEquals function instead. Also, if you want to know all the errors with detailed reasons, validateEquals function would be useful.

    On the other hand, if you want to allow superfluous property that is not enrolled to the type T, you can use is function instead.

    Type Parameters

    • T

      Type of the input value

    Parameters

    • input: T

      A value to be tested

    Returns input is T

    Whether the parametric value is equivalent to the type T or not

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

  • Tests equality between a value and its type.

    Tests a parametric value type and returns whether it's equivalent to the type T or not. If the parametric value is matched with the type T and there's not any superfluous property that is not listed on the type T, true value would be returned. Otherwise, the parametric value is not following the type T or some superfluous property exists, false value would be returned.

    If what you want is not just knowing whether the parametric value is following the type T or not, but throwing an exception with detailed reason, you can choose assertEquals function instead. Also, if you want to know all the errors with detailed reasons, validateEquals function would be useful.

    On the other hand, if you want to allow superfluous property that is not enrolled to the type T, you can use is function instead.

    Type Parameters

    • T

      Type of the input value

    Parameters

    • input: unknown

      A value to be tested

    Returns input is T

    Whether the parametric value is equivalent to the type T or not

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