dsherret / dsherret/code-block-writer
Suggestion: writer.pairedWrite(startToken, endToken, newLine, indent, block: () => void)
- Dominant language
- TypeScript
- Stars
- 218
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
I like `block()`, `quote()`, etc. But there are other pairings of tokens which are important: parentheses, square brackets, backticks for template strings, etc.
Suggested code:
```typescript
pairedWrite(
startToken: string,
endToken: string,
newLine: boolean,
indent: boolean,
block: () => void
) : void
{
this.write(startToken);
if (newLine) this.newLine();
indent ? this.indent(block) : block();
if (newLine) this.newLine();
this.write(endToken);
}
```
Paired writes could also be useful for (`// #region ...`, `// #endregion ...`) cases.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.