Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
index.js | D | 12-May-2024 | 465 | 25 | 18 | |
license | D | 12-May-2024 | 1.1 KiB | 22 | 17 | |
package.json | D | 12-May-2024 | 1.5 KiB | 73 | 72 | |
readme.md | D | 12-May-2024 | 867 | 43 | 22 |
readme.md
1# detect-newline [![Build Status](https://travis-ci.org/sindresorhus/detect-newline.svg?branch=master)](https://travis-ci.org/sindresorhus/detect-newline) 2 3> Detect the dominant newline character of a string 4 5 6## Install 7 8``` 9$ npm install --save detect-newline 10``` 11 12 13## Usage 14 15```js 16const detectNewline = require('detect-newline'); 17 18detectNewline('foo\nbar\nbaz\r\n'); 19//=> '\n' 20``` 21 22 23## API 24 25### detectNewline(input) 26 27Returns detected newline or `null` when no newline character is found. 28 29### detectNewline.graceful(input) 30 31Returns detected newline or `\n` when no newline character is found. 32 33 34## Related 35 36- [detect-newline-cli](https://github.com/sindresorhus/detect-newline-cli) - CLI for this module 37- [detect-indent](https://github.com/sindresorhus/detect-indent) - Detect the indentation of code 38 39 40## License 41 42MIT © [Sindre Sorhus](http://sindresorhus.com) 43