function buildDayPrices
buildDayPrices<Problem extends string = never>(
raw: object,
checkEntry: (
key: string,
value: unknown,
) =>
{ days: number; price: number; }
| Problem
| null
,
): DayPrices | Problem

Build a DayPrices map from raw entries. checkEntry reads one raw key/value pair and returns the day count and price to keep, null to skip that entry, or a problem message — which stops the walk and is returned in place of the map. Shared by the lenient stored-value reader (parseDayPrices) and the fail-closed admin API body parser.

Type Parameters

Problem extends string = never

Parameters

raw: object
checkEntry: (
key: string,
value: unknown,
) =>
{ days: number; price: number; }
| Problem
| null

Return Type

Usage

import { buildDayPrices } from "doc.ts";