Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

trim-off-newlines

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trim-off-newlines

Similar to String#trim() but removes only newlines

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
269K
decreased by-8.25%
Maintainers
2
Weekly downloads
 
Created

What is trim-off-newlines?

The trim-off-newlines npm package is a utility that allows you to trim newlines from the start and end of a string. It is useful for cleaning up strings that may have extraneous newline characters.

What are trim-off-newlines's main functionalities?

Trim newlines from the start and end of a string

This feature removes all newline characters from the beginning and end of the input string, leaving the core content intact.

const trimOffNewlines = require('trim-off-newlines');
const input = '\n\nHello, World!\n\n';
const output = trimOffNewlines(input);
console.log(output); // 'Hello, World!'

Trim newlines from the start of a string

This feature removes newline characters only from the beginning of the input string.

const trimOffNewlines = require('trim-off-newlines');
const input = '\n\nHello, World!\n\n';
const output = trimOffNewlines.start(input);
console.log(output); // 'Hello, World!\n\n'

Trim newlines from the end of a string

This feature removes newline characters only from the end of the input string.

const trimOffNewlines = require('trim-off-newlines');
const input = '\n\nHello, World!\n\n';
const output = trimOffNewlines.end(input);
console.log(output); // '\n\nHello, World!'

Other packages similar to trim-off-newlines

Keywords

FAQs

Package last updated on 24 Oct 2021

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