orcid-parser
    Preparing search index...

    Function sortByDate

    • Sorts works by publication date.

      Parameters

      • works: AnyWork[]

        Array of works to sort

      • order: "asc" | "desc" = 'desc'

        Sort order: 'asc' for ascending, 'desc' for descending (default: 'desc')

      Returns AnyWork[]

      New array of works sorted by publication date

      This function creates a new array and does not modify the original. Works without publication dates are sorted to the beginning (asc) or end (desc).

      const newest = sortByDate(works, 'desc');
      const oldest = sortByDate(works, 'asc');