dsherret / dsherret/code-block-writer

Iterative writes

Open
#16 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
218
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Similarly to the reason `conditionalWrite` was introducted, it would be really nice if we were not forced to break the chain and introduce a `for-of` loop with a single `writeLine` call.

Something along the lines of the following would be great.

```ts
const indexes = [5, 9, 10, 15, 17]

writer
.writeLine(`return [`)
.iterateWriteLine(indexes, index => `this.array[${index}],`)
.writeLine(`]`)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.