Every export

The complete public surface of truecopy, by entry point. Each module is also its own import, so a project that wants one pays for one.

Every module is its own entry point (truecopy/signature loads signature and nothing else), and the package is side-effect free, so a bundler drops what you do not import. The barrel (truecopy) re-exports all of it.

truecopy/table

readTable(file, options?) rows, warnings, boundaries, document (the two-line path)
Table the shape it returns

truecopy/open

openDocument(file, options?) the door: caps, deadline, engine released
UnreadableDocument carries reason so your application writes the sentence
Unreadable 'empty' | 'too-big' | 'no-text' | 'too-slow' | 'not-opened'
DEFAULT_LIMITS, Limits 20 MB, 40 pages, 30 s
OpenOptions the limits, plus workerSrc and pdfjs
PdfEngine what this library needs of an engine, structurally
withDeadline(promise, ms?) bound any read in time
positionedItems(items) the pure step between an engine and this library’s data

truecopy/layout

cellsOf(page, boundaries?) a page as a table of cells
placesOf(page, boundaries?) where each cell is, laid out identically
placeOf(items, page) where any group of items sits
boundariesFromRecurrence(rows, support?) keep only the x that come back row after row
boundariesFromAnchors(anchors) cut halfway between anchors you trust
columnBoundaries(items) the raw spread of x
columnAt(x, boundaries) which column an x falls into
rowToCells(row, boundaries) one row, cut
rowsFrom(items, boundaries) items into rows, by proximity of baseline
pageFrom(n, w, h, items) items into a page
documentFrom(pages, origin, name) pages into a document
documentFromText(text, name) a paste, a CSV, an export

truecopy/notation

readNumber(raw) how a page writes a figure, null rather than a guess
findNumbers(text, decimals?) every figure on a line, in order
isOnlyNumber(text, decimals?) a cell of figures, not prose quoting one
numberToken(decimals?) the pattern, to compose with
readDate(text, notation) a delimited date, in the stated order
readLeadingDate(text, notation, yearWhenMissing?) the date a line starts with, and its length
Notation, FoundNumber, LeadingDate

truecopy/signature

findRowAnomalies(rows, options, judged?) the rows that break the table’s shape
thresholdsFor(kinds, share) one share for every kind named
SignatureOptions, KindThreshold, RowAnomaly

truecopy/columns

profileColumns(rows, options) what each column holds, counted once
dominantKind(profile, thresholds) the kind a column is made of
columnCount(rows), cellAt(row, column)
ColumnProfile, ProfileOptions

truecopy/roles

assignRoles(profiles, rules) what each column IS
dominantKinds(profiles, thresholds) the raw reading, for a caller with no roles of its own
RoleRule role, kind, minimum, take, among

truecopy/schema

schemaOf(schema) one declaration, two outputs
RecordOf<typeof schema> the record type, read back off it
validate(schema, records) the first rule that broke, or null
validateWith(standardSchema, records, rule) bring your own Zod, Valibot or ArkType
conforms(schema, record) one record
Schema, Field, FieldFormat, SchemaViolation, StandardSchema

truecopy/classify

classifyDocument(text, kinds) the kind, with precedence
requirementHolds(text, requirement) one requirement
DocumentKind, Requirement, PatternSet

truecopy/pattern

compilePattern(raw, options?) domain knowledge as data, behind a guard
compilePatterns(raws, options?)
toRawPattern(pattern), toRawPatterns(patterns) back to JSON
countMatches(text, pattern)
NEVER_MATCHES what a rejected pattern compiles to
RawPattern, CompileOptions

truecopy/explain

explainDocument(document, options?) what the reading decided, as text
explainRows(rows, options?) the same, for rows that never came from a page
describeAnomaly(anomaly) one anomaly, in words
ExplainOptions

truecopy/contract

readDocument(document, reader) drive a reading, and enforce the one rule
discrepancyOf(check) the smallest gap among the declared values
Reader read, selfCheck, rowsToReview, and two optional
ReadResult, Reading, SelfCheck, Discrepancy, Refusal, ReviewableRow, Verdict

truecopy/kit

checkContract(reader, corpus, options) six rules, in your own suite
contractReport(results) the run as a file you commit
failures(results) what went red, in sentences
pdfWithText(words), pdfWithPages(pages) a real PDF, xref table included
documentWithoutSubstance() for rule 5
CorpusCase, CheckResult, ContractOptions, PlacedWord

truecopy (types)

Document, TextPage, Row, PositionedItem, Place.