1. trim-newlines
Trim newlines from the start and/or end of a string
trim-newlines
Package: trim-newlines
Created by: sindresorhus
Last modified: Sat, 17 Jun 2023 00:08:37 GMT
Version: 5.0.0
License: MIT
Downloads: 62,645,772
Repository: https://github.com/sindresorhus/trim-newlines

Install

npm install trim-newlines
yarn add trim-newlines

trim-newlines

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

Looking to trim all whitespace, not just newlines? Use String#trim(), String#trimStart(), or String#trimEnd().

Install

 npm install trim-newlines

Usage

 import {trimNewlines, trimNewlinesStart, trimNewlinesEnd} from 'trim-newlines';

trimNewlines('\nšŸ¦„\nšŸ¦„\r\n');
//=> 'šŸ¦„\nšŸ¦„'

trimNewlinesStart('\nšŸ¦„\r\n');
//=> 'šŸ¦„\r\n'

trimNewlinesEnd('\nšŸ¦„\r\n');
//=> '\nšŸ¦„'

API

trimNewlines(string)

Trim from the start and end of a string.

trimNewlinesStart(string)

Trim from the start of a string.

trimNewlinesEnd(string)

Trim from the end of a string.

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin