Options
All
  • Public
  • Public/Protected
  • All
Menu

Module hashSort

Index

References

Functions

References

Renames and re-exports hashSort

Functions

  • hashSort<T>(collection: T[], indexer?: Indexer<T>, reverse?: boolean): T[]
  • hash sort function

    since

    5.21.0

    example
    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 }
    // ]

    Type parameters

    • T

    Parameters

    • collection: T[]

      array collection

    • Optional indexer: Indexer<T>

      extract numeric index from each item of collection

    • reverse: boolean = false

      reverse the sort order (DESC)

    Returns T[]

    the sorted list