orcid-parser
    Preparing search index...

    Function groupBy

    • Groups works by a specified property key.

      Parameters

      • works: AnyWork[]

        Array of works to group

      • key:
            | "putCode"
            | "createdDate"
            | "lastModifiedDate"
            | "source"
            | "title"
            | "subtitle"
            | "translatedTitle"
            | "externalIds"
            | "publicationYear"
            | "publicationMonth"
            | "publicationDay"
            | "journalTitle"
            | "url"

        Property key to group by (e.g., 'type', 'publicationYear')

      Returns Record<string, AnyWork[]>

      Object mapping group keys to arrays of works

      Works with undefined values for the grouping key are placed in the 'unknown' group.

      const byType = groupBy(works, 'type');
      const byYear = groupBy(works, 'publicationYear');