🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

trim-newlines

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trim-newlines

Trim newlines from the start and/or end of a string

5.0.0
latest
Source
npm
Version published
Weekly downloads
11M
-26.06%
Maintainers
1
Weekly downloads
 
Created

What is trim-newlines?

The trim-newlines npm package is used to remove newlines from the start and/or end of a string. It provides a simple way to trim newline characters from the beginning, end, or both ends of a string, which can be useful when processing text data.

What are trim-newlines's main functionalities?

Start

Removes newline characters from the start of a string.

const trimNewlines = require('trim-newlines');
console.log(trimNewlines.start('\n\nUnicorn\n'));
//=> 'Unicorn\n'

End

Removes newline characters from the end of a string.

const trimNewlines = require('trim-newlines');
console.log(trimNewlines.end('Unicorn\n\n'));
//=> 'Unicorn'

Start and End

Removes newline characters from both the start and end of a string.

const trimNewlines = require('trim-newlines');
console.log(trimNewlines('\n\nUnicorn\n\n'));
//=> 'Unicorn'

Other packages similar to trim-newlines

Keywords

trim

FAQs

Package last updated on 20 Mar 2023

Did you know?

Socket

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