NewDash

    Function hashSort

    • hash sort function

      Type Parameters

      • T

      Parameters

      • collection: T[]

        array collection

      • Optionalindexer: Indexer<T>

        extract numeric index from each item of collection

      • reverse: boolean = false

        reverse the sort order (DESC)

      Returns T[]

      the sorted list

      5.21.0

      hashSort([2, 999, 3, 113, 3, 32, 3, 4])
      // [2, 3, 3, 3, 4, 32, 113, 999]

      hashSort(
      [
      { age: 2 },{ age: 999 },{ age: 3 },
      { age: 113 },{ age: 3 },{ age: 32 },
      { age: 3 },{ age: 4 }
      ],
      (item) => item.age
      )
      // [
      // { age: 2 },{ age: 3 },{ age: 3 },
      // { age: 3 },{ age: 4 },{ age: 32 },
      // { age: 113 },{ age: 999 }
      // ]
    MMNEPVFCICPMFPCPTTAAATR