1. normalize-newline
Normalize the newline characters in a string to `\n`
normalize-newline
Package: normalize-newline
Created by: sindresorhus
Last modified: Fri, 16 Jun 2023 22:40:45 GMT
Version: 4.1.0
License: MIT
Downloads: 177,022
Repository: https://github.com/sindresorhus/normalize-newline

Install

npm install normalize-newline
yarn add normalize-newline

normalize-newline

Normalize the newline characters in a string to \n

Install

$ npm install normalize-newline

Usage

 import normalizeNewline from 'normalize-newline';

normalizeNewline('foo\r\nbar\nbaz');
//=> 'foo\nbar\nbaz'

normalizeNewline(Buffer.from('foo\r\nbar\nbaz')).toString();
//=> 'foo\nbar\nbaz'

API

normalizeNewline(input)

input

Type: string | Buffer

Input to normalize.

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