• The function isComparable in TypeScript checks if a value is comparable, handling primitive values and objects with optional force comparison.

    Parameters

    • value: unknown

      The value parameter in the isComparable function represents the value that you want to check if it is comparable. It can be of any type (unknown), and the function will determine if it is comparable based on certain conditions.

    • OptionalisForceObjectComparable: boolean = false

      The isForceObjectComparable parameter in the isComparable function is a boolean flag that determines whether to treat non-primitive values as comparable objects. When set to true, it forces the function to consider non-primitive values as comparable objects, regardless of their type.

    Returns value is Comparable

    The function isComparable returns a boolean value indicating whether the value is considered comparable or not.