assertJsonSerializable #
Throws when a value cannot be written as JSON, naming the path of the first value that cannot.
Usage #
TypeScript
import { assertJsonSerializable } from 'kawapress'
assertJsonSerializable({ title: 'Hi' }, { label: 'page data' })Parameters
valueunknown
The value to check.
optionsoptionalJsonOperationOptions
Names used in the error message.
default {}
labeloptionalstring
What the value is, named in the error message, for example page data.
pathoptionalstring
Where the value sits, named in the error message, for example pageData.headers.
Full type signature
TypeScript
function assertJsonSerializable(value: unknown, options?: JsonOperationOptions): void

Comments