@kubohiroya/turbowarp-text-lines
v0.1.0
Published
A TurboWarp extension for counting, reading, and splitting text by lines.
Readme
TurboWarp Text Lines
A TurboWarp extension for counting, reading, and splitting text by lines.
Blocks
number of lines in [TEXT]
Returns the number of lines in the supplied text.
| Property | Value |
|---|---|
| Type | Reporter |
| Opcode | lineCount |
| TEXT | String, default: first line\nsecond line |
line [LINE] of [TEXT]
Returns one line using a one-based line number. Invalid line numbers return an empty string.
| Property | Value |
|---|---|
| Type | Reporter |
| Opcode | lineAt |
| TEXT | String, default: first line\nsecond line |
| LINE | Number, default: 1 |
put lines of [TEXT] into list [LIST]
Replaces the contents of the named Scratch list with the lines of the supplied text.
| Property | Value |
|---|---|
| Type | Command |
| Opcode | writeLinesToList |
| TEXT | String, default: first line\nsecond line |
| LIST | String, default: lines |
Line numbers are one-based. An invalid line number returns an empty string. The list block replaces the contents of the named Scratch list.
The extension accepts LF, CRLF, and CR line endings.
Development
npm install
npm run checkRegenerate the block documentation after changing src/block-definitions.json:
npm run docsThe build produces dist/text-lines.js.
Because the extension writes directly to Scratch list variables, load it as an unsandboxed custom extension.
License
MPL-2.0
