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

    Variable decode

    decode: (
        text: string,
        opts?: { registry?: export=; strict?: boolean; trusted?: boolean },
    ) => unknown

    Type Declaration

      • (
            text: string,
            opts?: { registry?: export=; strict?: boolean; trusted?: boolean },
        ): unknown
      • Decodes .dxn text into a value — every DXN type maps to a native JS value or a DXN* wrapper class, see src/values/index.cjs's DXNValue typedef for the full mapping. Throws DXNError on malformed input, including a schema violation for any registered struct name the text uses.

        Safe by default: keyword decodes as DXNKeyword, so no input can fill the global symbol registry. Pass trusted: true (or a registry with putTrusted(true)) for a source you control -- your own config, your own application's data -- and it decodes as a real, global Symbol.for(name), the closest native analog to a BEAM atom and, like one, never garbage collected. symbol is unaffected either way.

        registry: (a Registry built via schema.compile) enables schema-backed struct decoding and custom-tag decoding for any name it knows — a struct/tag with no matching registry entry falls back to an opaque DXNStruct/DXNCustomTag, never a hard failure.

        Parameters

        • text: string
        • Optionalopts: { registry?: export=; strict?: boolean; trusted?: boolean } = {}

        Returns unknown