flatbuffers-format API
    Preparing search index...

    Function format

    • Format a FlatBuffers schema source string into the canonical form.

      The returned string is a fixed point: format(format(x)) === format(x). Comments, doc comments, and paragraph breaks between top-level declarations are preserved.

      Parameters

      Returns string

      The formatted schema, including a single trailing newline.

      if the input fails to parse. The error carries the line and column of the first reported syntax problem.

      if the output would not contain every comment of the input. This is a formatter bug; the input is fine.

      if the output's code tokens would differ from the input's. Also a formatter bug.

      import { format } from "flatbuffers-format";

      const ugly = "table T{x:int;y:string=\"hi\";}";
      format(ugly);
      // -> "table T {\n x: int;\n y: string = \"hi\";\n}\n"

      format(ugly, { indent: 4 });
      // -> "table T {\n x: int;\n y: string = \"hi\";\n}\n"