detect-newline
Detect the dominant newline character of a string
Last updated 6 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(string)

Returns the detected newline or \n when no newline character is found.

Related

License

MIT © Sindre Sorhus

Current Tags

  • 3.0.0                                ...           latest (6 months ago)

10 Versions

  • 3.0.0                                ...           6 months 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                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 319
This Week 14,549
This Month 94,374
Last Day 7,138
Last Week 37,084
Last Month 140,655
Dependencies (0)
None
Dev Dependencies (3)
Dependents (121)

Copyright 2014 - 2016 © taobao.org |