import { CodeBlockWriter } from "https://deno.land/x/deno2node@v1.10.0/src/deps.deno.ts";
Code writer that assists with formatting and visualizing blocks of JavaScript or TypeScript code.
Constructors
Constructor.
Methods
Writes a blank line.
Writes a blank line if the last written text was not a blank line.
Writes a block using braces.
Writes text to exit a comment if in a comment.
Writes a blank line if the condition is true.
Writes a newline if the condition is true.
Conditionally writes text.
Conditionally writes text.
Conditionally writes a line of text.
Conditionally writes a line of text.
Gets if the writer ends with the provided text.
Gets the current indentation level.
Gets the last char written.
Gets the length of the string in the writer.
Gets the options.
Writes the text within the provided action with hanging indentation.
Writes the text within the provided action with hanging indentation unless writing a block.
Indents the code one level for the current line.
Indents a block of code.
Writes an inline block with braces.
Gets if the writer is currently at the start of the first line of the text, block, or indentation block.
Gets if the writer is currently in a comment.
Gets if the writer is currently in a string.
Gets if the last chars written were for a blank line.
Gets if the last chars written were for a newline.
Gets if the last char written was a space.
Gets if the last char written was a tab.
Gets if the writer is currently on the first line of the text, block, or indentation block.
Iterates over the writer character char codes in reverse order. The iteration stops when a non-null or undefined value is returned from the action. The returned value is then returned by the method.
Iterates over the writer characters in reverse order. The iteration stops when a non-null or undefined value is returned from the action. The returned value is then returned by the method.
Writes a newline.
Writes a newline if the last line was not a newline.
Queues the indentation level for the next lines written.
Queues the indentation level for the next lines written using the provided indentation text.
Writes a quote character.
Writes text surrounded in quotes.
Sets the current indentation level.
Sets the current indentation using the provided indentation text.
Writes a space.
Writes a space if the last character was not a space.
Writes a tab.
Writes a tab if the last character was not a tab.
Gets the writer's text.
Inserts text at the provided position.
This method is "unsafe" because it won't update the state of the writer unless inserting at the end position. It is biased towards being fast at inserting closer to the start or end, but slower to insert in the middle. Only use this if absolutely necessary.
Sets the indentation level within the provided action and restores the writer's indentation state afterwards.
Sets the indentation level with the provided indentation text within the provided action and restores the writer's indentation state afterwards.
Writes the provided text.
Writes a line of text.