Skip to content

GetUniqueValues

cartographer


cartographer / getUniqueValues

getUniqueValues(items, fieldKey): FieldValue[]

Defined in: queries/queryFunctions.ts:354

Get sorted unique values from a field (including from array fields).

For array fields, extracts all individual values. Results are sorted alphabetically.

CatalogItem[]

Array of items to extract values from

string

Field key to extract unique values from

FieldValue[]

  • Sorted array of unique field values
const authors = getUniqueValues(items, 'authors');
// ['Lovecraft, H. P.', 'Smith, Clark Ashton', ...]