Skip to content

Documentation / @finchart/tools / serializeDrawings

Function: serializeDrawings() ​

serializeDrawings(drawings): string

Defined in: tools/src/drawings.ts:595

Turns an array of drawings into a string. Rebuilds each one from our own fields before saving — what a consumer passes in might be an object from their own store, and handing it to JSON.stringify without normalizing it would let a getter-only class instance save as {} — which the next session's parser then rejects outright (a quiet, total loss of the ledger) — or would let a circular reference or a throwing getter leak straight through.

The same toOwnedDrawing normalization as add / load applies here too. This is an input API, so an unfit element throws ContractError (the parser's null policy belongs to the read side).

Parameters ​

drawings ​

readonly Drawing[]

Returns ​

string