@blockchaincommons/known-values - v1.0.0-beta.4
    Preparing search index...

    Function parseRegistryFile

    • Parses the text of a registry file exactly as the reference does with serde_json::from_str::<RegistryFile>.

      Unknown fields are skipped at every level, a repeated known field or a missing required one is an error, null for an optional field reads as absent, and a struct may also be given as an array of its fields in order. Nesting is limited to 128 levels except while skipping unknown fields.

      Parameters

      • text: string

        The file's content; a JS string, so already valid Unicode.

      Returns RegistryFile

      The parsed file.

      With code Json and serde_json's message, including at line L column C (byte-based), when text is not a registry file; with code InvalidParameter when text is not a string.

      const file = parseRegistryFile('{"entries":[{"codepoint":1000,"name":"myValue"}]}');
      file.entries[0].codepoint; // 1000n