Huge News!Announcing our $40M Series B led by Abstract Ventures.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
  • Socket score

Version published
Maintainers
1
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

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc