Endo API documentation
    Preparing search index...

    Function pathCompare

    Compares two string arrays and returns a comparison result.

    The algorithm is as follows:

    1. Check if either value is undefined. If both are undefined, return 0. If a is undefined, return 1. If b is undefined, return -1.
    2. Check the lengths of the arrays. If they are different, return the difference.
    3. Check the cumulative lengths of the arrays using the count of UTF-16 units in each string. If they are different, return the difference.
    4. Check the individual elements of the arrays via lexical comparison. If they are different, return the difference.
    5. If all elements are the same ("deep equality"), return 0.
    • Comparison function for two values of the same type T.

      Can be used with Array.prototype.sort and other similar contexts

      Parameters

      • a: undefined | string[]

        First value

      • b: undefined | string[]

        Second value

      Returns number

      Negative integer if a < b; positive integer if a > b; 0 if equal