Socket
Socket
Sign inDemoInstall

trim-trailing-lines

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    trim-trailing-lines

Remove final line feeds from a string


Version published
Maintainers
1
Install size
5.57 kB
Created

Package description

What is trim-trailing-lines?

The npm package 'trim-trailing-lines' is designed to remove trailing newline characters from a string. This is particularly useful in text processing where consistent formatting is required, or when preparing output for further processing that does not handle trailing newlines well.

What are trim-trailing-lines's main functionalities?

Trim trailing newlines

This feature allows you to remove all trailing newline characters from the end of a string. It is useful for cleaning up text data before saving or processing it further.

const trimTrailingLines = require('trim-trailing-lines');
const result = trimTrailingLines('Hello World\n\n');
console.log(result); // 'Hello World'

Other packages similar to trim-trailing-lines

Readme

Source

trim-trailing-lines

Build Coverage Downloads Size

Remove final line feeds from a string.

Install

npm:

npm install trim-trailing-lines

Use

var trimTrailingLines = require('trim-trailing-lines')

trimTrailingLines('foo\nbar') // => 'foo\nbar'
trimTrailingLines('foo\nbar\n') // => 'foo\nbar'
trimTrailingLines('foo\nbar\n\n') // => 'foo\nbar'

API

trimTrailingLines(value)

Remove final line feed characters from value.

Parameters
  • value (string) — Value with trailing line feeds, coerced to string.
Returns

string — Value without trailing newlines.

License

MIT © Titus Wormer

Keywords

FAQs

Last updated on 28 Oct 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc