Nomenclature Predictably Misunderstood

    trim-trailing-lines
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0 • Public • Published

    trim-trailing-lines

    Build Coverage Downloads Size

    Remove final line feeds from a string.

    Install

    This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

    npm:

    npm install trim-trailing-lines

    Use

    import {trimTrailingLines} from 'trim-trailing-lines'
    
    trimTrailingLines('foo\nbar') // => 'foo\nbar'
    trimTrailingLines('foo\nbar\n') // => 'foo\nbar'
    trimTrailingLines('foo\nbar\n\n') // => 'foo\nbar'

    API

    This package exports the following identifiers: trimTrailingLines. There is no default export.

    trimTrailingLines(value)

    Remove final line feed characters from value.

    Parameters
    • value (string) — Value with trailing line feeds, coerced to string.
    Returns

    string — Value without trailing newlines.

    License

    MIT © Titus Wormer

    Install

    npm i trim-trailing-lines

    DownloadsWeekly Downloads

    2,761,352

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    5.13 kB

    Total Files

    5

    Last publish

    Collaborators

    • wooorm