@particle/detect-newline-style

3.0.2 • Public • Published

@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

Param Type Default Description
input string The string you want to analyze
[options] object
[options.defaultEOL] string "'\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

Readme

Keywords

none

Package Sidebar

Install

npm i @particle/detect-newline-style

Weekly Downloads

2

Version

3.0.2

License

UNLICENSED

Unpacked Size

4.49 kB

Total Files

4

Last publish

Collaborators

  • jackson-particle
  • mike.grundy.npm
  • mohitparticle
  • eugene_particle
  • kmok23
  • karlag
  • cole-abbeduto-particle
  • pedrosordo
  • guohui
  • sbrust
  • particlebot
  • no1089
  • carlos.hdez
  • keeramis5
  • monkbroc
  • suda
  • mstan
  • sergeuz
  • debbie23
  • avtolstoy
  • mlauer
  • wraithan
  • azenk
  • bwalach
  • parteberseth
  • rickkas7
  • mrlambchop_particle
  • hugo.montero
  • mphsi