detect-newline
Detect the dominant newline character of a string
Last updated 7 months ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install detect-newline 
SYNC missed versions from official npm registry.

detect-newline Build Status

Detect the dominant newline character of a string

Install

$ npm install detect-newline

Usage

const detectNewline = require('detect-newline');

detectNewline('foo\nbar\nbaz\r\n');
//=> '\n'

API

detectNewline(string)

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

detectNewline.graceful(unknown)

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

Related

License

MIT © Sindre Sorhus

Current Tags

  • 3.1.0                                ...           latest (7 months ago)

11 Versions

  • 3.1.0                                ...           7 months ago
  • 3.0.0                                ...           a year ago
  • 2.1.0                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 2,172
This Week 67,216
This Month 67,216
Last Day 4,366
Last Week 70,838
Last Month 270,451
Dependencies (0)
None
Dev Dependencies (3)
Dependents (173)

Copyright 2014 - 2016 © taobao.org |