Skip to content

ItemToObject

cartographer


cartographer / itemToObject

itemToObject(item, settings): Record<string, string | number | boolean | string[] | Date | null>

Defined in: types/types.ts:104

Helper to work with items as strongly-typed objects. Converts a CatalogItem to a plain object with all schema fields included.

CatalogItem

The CatalogItem to convert

DatacoreSettings

Plugin settings (contains the schema)

Record<string, string | number | boolean | string[] | Date | null>

  • Plain object with all schema fields (missing fields are null)
const obj = itemToObject(item, settings);
// Returns: { title: 'The Story', authors: ['Author'], year: 1928, ... }