1.0.1 • Published 8 months ago

eol-utils v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

eol-utils

Easy-to-use regex functions to format line breaks as Carriage Return Line Feed CR LF (Windows), Line Feed LF (Unix) and Carriage Return CR (Mac OS <= 9).

Installation

npm i eol-utils

Usage

Import the desired function(s) and pass in a string to normalize its line breaks.

import { crlf, lf, cr } from 'eol-utils';

let str = '\rHello\nWorld\r\n';

console.log(crlf(str)); // --> '\r\nHello\r\nWorld\r\n'
console.log(lf(str)); // --> '\nHello\nWorld\n'
console.log(cr(str)); // --> '\rHello\rWorld\r'

Contributing

Contributions welcome.

License

The MIT License (MIT) 2024 - clhilgert. Please refer to LICENSE for more details.