Skip to content

Strip newlines in transforms - #919

Merged
sindresorhus merged 2 commits into
mainfrom
transform-newline
Mar 22, 2024
Merged

sindresorhus merged 2 commits into
mainfrom
transform-newline

Conversation

@ehmicky

@ehmicky ehmicky commented Mar 21, 2024 •

Copy link
Copy Markdown
Collaborator

This PR improves how newlines are handled in transforms:

  • The newline is now automatically stripped from each line argument passed to transforms
  • yield string statements do not need to add a newline at the end of string anymore. Each yield produces a new line (kindof like console.log()).

The above behavior can be disabled by passing a {transform, newline: true} plain object.

As an added bonus, the stripFinalNewline option now works with the lines option. If lines: true is used, and stripFinalNewline: true is used too, it will be applied to each line, i.e. each item of the result.stdout/result.stderr array.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants