strip-final-newline

WebJar for strip-final-newline

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

strip-final-newline
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

strip-final-newline
WebJar for strip-final-newline
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/strip-final-newline

Download strip-final-newline

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/strip-final-newline/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>strip-final-newline</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/strip-final-newline/
implementation 'org.webjars.npm:strip-final-newline:2.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/strip-final-newline/
implementation ("org.webjars.npm:strip-final-newline:2.0.0")
'org.webjars.npm:strip-final-newline:jar:2.0.0'
<dependency org="org.webjars.npm" name="strip-final-newline" rev="2.0.0">
  <artifact name="strip-final-newline" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='strip-final-newline', version='2.0.0')
)
libraryDependencies += "org.webjars.npm" % "strip-final-newline" % "2.0.0"
[org.webjars.npm/strip-final-newline "2.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

strip-final-newline Build Status

Strip the final newline character from a string/buffer

Can be useful when parsing the output of, for example, ChildProcess#execFile, as binaries usually output a newline at the end. Normally, you would use stdout.trim(), but that would also remove newlines at the start and whitespace.

Install

$ npm install strip-final-newline

Usage

const stripFinalNewline = require('strip-final-newline');

stripFinalNewline('foo\nbar\n\n');
//=> 'foo\nbar\n'

stripFinalNewline(Buffer.from('foo\nbar\n\n')).toString();
//=> 'foo\nbar\n'

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Versions

Version
2.0.0