Skip to content

Iteration with [...new LineBreaker('...')] etc #52

@lionel-rowe

Description

@lionel-rowe

A useful convenience would be adding a *[Symbol.iterator]() method for a friendlier and more idiomatic API compared to the current nextBreak-based one.

console.log([...new LineBreaker('...')]); // [{ position: 3, required: false, substring: '...' }]

for (const bk of new LineBreaker('...')) {
  console.log(bk); // { position: 3, required: false, substring: '...' }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions