StringBuilder collects pieces of text and joins them into one string at the end, like .NET's StringBuilder.
npm install @tsdotnet/string-builderimport StringBuilder from '@tsdotnet/string-builder';
const sb = new StringBuilder('Hello');
sb.append(', ', 'world').appendLine('!');
sb.toString(); // "Hello, world!\n"join(delimiter) joins the parts with a separator, and clear() empties the builder for reuse.
ESM (import StringBuilder from '@tsdotnet/string-builder';) or CommonJS (const StringBuilder = require('@tsdotnet/string-builder').default;).
In a browser, without a bundler
<script src="https://cdn.jsdelivr.net/npm/@tsdotnet/string-builder@1/dist/umd/string-builder.min.js"></script>
<script>
const StringBuilder = tsdotnet.stringBuilder.default;
</script>