Appearance
Hydrate
Fingermark Hydrater for products
Overview
Hydrate is a utility library for hydrating our custom product structure. We traverse the customisations and options fields and recursivly hydrate them
Usage
js
import { createHydrater } from '@fingermarkglobal/hydrate`
const items = [
// Fingermark standard menu
]
const hydrate = createHydrater({ items, type: 'raw' }) // 'raw' for no default product format, 'formatted' for preformatted format
const product = hydrate({ id: 31245 })
console.log(product)
// { id: 31245, name: 'Big Chungus', customisations: [...], options: [...] }