Function byLength

  • Compares two values by their length property. Puts the value with the shorter length first.

    Example

    ['abc', 'a', 'ab'].sort(byLength) == ['a', 'ab', 'abc'];
    

    Parameters

    • a: { length: number }

      first value

      • length: number
    • b: { length: number }

      second value

      • length: number

    Returns number

Generated using TypeDoc