November's Paddleball Marathon

    @particle/detect-newline-style

    3.0.1 • 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

    Keywords

    none

    Install

    npm i @particle/detect-newline-style

    DownloadsWeekly Downloads

    90

    Version

    3.0.1

    License

    UNLICENSED

    Unpacked Size

    4.53 kB

    Total Files

    4

    Last publish

    Collaborators

    • amaury.particle
    • cole-abbeduto-particle
    • pedrosordo
    • rowan.hamilton
    • guohui
    • sbrust
    • busticated
    • particlebot
    • no1089
    • carlos.hdez
    • keeramis5
    • monkbroc
    • suda
    • mstan
    • sergeuz
    • debbie23
    • avtolstoy
    • mlauer
    • wraithan
    • toolboxbot
    • azenk
    • shewy
    • bwalach
    • parteberseth
    • rickkas7
    • mrlambchop_particle
    • hugo.montero
    • toddparticle
    • mphsi