3.0.2 • Published 3 years ago

@particle/detect-newline-style v3.0.2

Weekly downloads
21
License
UNLICENSED
Repository
-
Last release
3 years ago

@particle/detect-newline-style

Determine a string's preferred newline character

Installation

npm install @particle/detect-newline-style --save

API

@particle/detect-newline-style


module.exports(input, options) ⇒ string

Figure out which newline style a given string uses (windows: \r\n or unix: \n)

Kind: Exported function
Returns: string - Either \r\n or \n based on string contents

ParamTypeDefaultDescription
inputstringThe string you want to analyze
optionsobject
options.defaultEOLstring"'\n'"Default newline character

Example

const newline = detectNewlineStyle('foo\nbar\r\n\baz\n');
console.log(newline); // '\n'

NOTE: Unfortunately, docs have a nasty habit of falling out of date. When in doubt, check usage in tests

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.3

3 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

6 years ago