node-dextrin - v0.1.0
    Preparing search index...

    Class export=

    The result of compiling one %schema{} entry from a .dxns document (schema/compiler.cjs) — enough to both validate a decoded value and convert it both directions between .dxnb's always-positional wire shape and a named field map. Mirrors Dextrin.Schema.Compiled.

    fields is ordered — that order is the canonical position <-> name mapping .dxnb's positional struct encoding needs, which is exactly why a schema's own fields: has to be an @ordered %{...} in the source document, not a plain map (.dxn's map type makes no ordering guarantee, but field order here is semantically load-bearing, not incidental).

    Index
    • Parameters

      • spec: {
            closed?: boolean;
            fields?: export=[];
            forbidden?: string[];
            name?: string | null;
            refineFn?: RefineFn | null;
        } = {}

      Returns Compiled

    closed: boolean
    fields: export=[]
    forbidden: string[]
    name: string | null
    refineFn: RefineFn | null
    • Reads instance's fields (an arbitrary registered JS class instance, not a DXNStruct) out in this schema's own canonical field order — the same order .dxnb's positional wire encoding needs. A field this schema declares but instance doesn't have is undefined, same as any other absent field; extra instance properties the schema doesn't know about are simply not included.

      Parameters

      • instance: object

      Returns [string, unknown][]