Skip to content

bintastic / text

Function: text()

text(strings, ...values): string

Defined in: text.ts:145

Creates text file content from a template string.

Leading and trailing blank lines are removed and the indentation common to the template literal is stripped. The indentation is computed only from the template text, so interpolated values are inserted verbatim: a multi-line value neither changes the detected indent nor gets re-indented. No trailing newline is added; append one explicitly if the file requires it.

Parameters

strings

TemplateStringsArray

The text template string segments.

values

...unknown[]

Values to interpolate into the text template.

Returns

string

The normalized text file content.

Example

ts
import { text } from 'bintastic';

project.files = {
  'src/index.js': text`
    export default 42;
  `,
};
await project.write();