Big update!Announcing Socket for GitHub 1.0. Learn more
Socket
BlogLoveFAQ
Install
Log in

detect-newline

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Issues
File Explorer

Advanced tools

detect-newline

Detect the dominant newline character of a string

    4.0.0latest

Version published
Maintainers
1
Weekly downloads
17,372,583
increased by0.79%

Weekly downloads

Changelog

Source

Breaking

  • Require Node.js 12.20 5539419
  • This package is now pure ESM. Please read this.

https://github.com/sindresorhus/detect-newline/compare/v3.1.0...v4.0.0

Readme

Source

detect-newline

Detect the dominant newline character of a string

Install

npm install detect-newline

Usage

import {detectNewline} from 'detect-newline'; detectNewline('foo\nbar\nbaz\r\n'); //=> '\n'

API

detectNewline(string)

Returns the detected newline or undefined when no newline character is found.

detectNewlineGraceful(unknown)

Returns the detected newline or \n when no newline character is found or the input is not a string.

Keywords

FAQs

What is detect-newline?

Detect the dominant newline character of a string

Is detect-newline popular?

The npm package detect-newline receives a total of 16,634,937 weekly downloads. As such, detect-newline popularity was classified as popular.

Is detect-newline well maintained?

We found that detect-newline demonstrated a healthy version release cadence and project activity. It has 1 open source maintainer collaborating on the project.

Last updated on 14 Oct 2021
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc