Skip to main content

createBlockBuilder

@retinue/monorepo


@retinue/monorepo / backend/src / createBlockBuilder

Function: createBlockBuilder()

createBlockBuilder(limits): object

Defined in: backend/src/documents/parsers/text.ts:28

Accumulates blocks against the limits, so every parser stops the same way.

Shared rather than repeated: the two parsers in this module and the PDF one all need the same three ceilings, and three copies of "am I over budget" is three chances for one of them to be wrong.

Parameters​

limits​

ExtractionLimits

Returns​

truncated​

Get Signature​

get truncated(): boolean

Returns​

boolean

done()​

done(pageCount?): ExtractedDocument

Parameters​

pageCount?​

number

Returns​

ExtractedDocument

push()​

push(block): boolean

Returns false once full, so a caller can stop reading rather than keep parsing into a bin.

Parameters​

block​

DocumentBlock

Returns​

boolean

warn()​

warn(message): void

Parameters​

message​

string

Returns​

void