Function sort_strings_by_length_and_position

  • Algorithm sort = by string length + by current position in array NEEDS REFACTOR: does [].sort() twice!


    • arr: string[]

      array of strings

    • prefer_position: number = 1

      number to multiply position rating, to make it more important than length

    • fix_min_length: number = 0

      absolute minimum allowed to be used as min_length (default 4) ex: if 4, algorithm will treat str.length of 2,3,4 the same

    Returns string[]

Generated using TypeDoc