aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/detect-newline
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/detect-newline')
-rw-r--r--deps/npm/node_modules/detect-newline/index.js24
-rw-r--r--deps/npm/node_modules/detect-newline/license21
-rw-r--r--deps/npm/node_modules/detect-newline/package.json72
-rw-r--r--deps/npm/node_modules/detect-newline/readme.md42
4 files changed, 159 insertions, 0 deletions
diff --git a/deps/npm/node_modules/detect-newline/index.js b/deps/npm/node_modules/detect-newline/index.js
new file mode 100644
index 0000000000..940329e5ac
--- /dev/null
+++ b/deps/npm/node_modules/detect-newline/index.js
@@ -0,0 +1,24 @@
+'use strict';
+module.exports = function (str) {
+ if (typeof str !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ var newlines = (str.match(/(?:\r?\n)/g) || []);
+
+ if (newlines.length === 0) {
+ return null;
+ }
+
+ var crlf = newlines.filter(function (el) {
+ return el === '\r\n';
+ }).length;
+
+ var lf = newlines.length - crlf;
+
+ return crlf > lf ? '\r\n' : '\n';
+};
+
+module.exports.graceful = function (str) {
+ return module.exports(str) || '\n';
+};
diff --git a/deps/npm/node_modules/detect-newline/license b/deps/npm/node_modules/detect-newline/license
new file mode 100644
index 0000000000..654d0bfe94
--- /dev/null
+++ b/deps/npm/node_modules/detect-newline/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/deps/npm/node_modules/detect-newline/package.json b/deps/npm/node_modules/detect-newline/package.json
new file mode 100644
index 0000000000..088e60c07c
--- /dev/null
+++ b/deps/npm/node_modules/detect-newline/package.json
@@ -0,0 +1,72 @@
+{
+ "_args": [
+ [
+ "detect-newline@2.1.0",
+ "/Users/rebecca/code/npm"
+ ]
+ ],
+ "_from": "detect-newline@2.1.0",
+ "_id": "detect-newline@2.1.0",
+ "_inBundle": false,
+ "_integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=",
+ "_location": "/detect-newline",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "detect-newline@2.1.0",
+ "name": "detect-newline",
+ "escapedName": "detect-newline",
+ "rawSpec": "2.1.0",
+ "saveSpec": null,
+ "fetchSpec": "2.1.0"
+ },
+ "_requiredBy": [
+ "/"
+ ],
+ "_resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz",
+ "_spec": "2.1.0",
+ "_where": "/Users/rebecca/code/npm",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "bugs": {
+ "url": "https://github.com/sindresorhus/detect-newline/issues"
+ },
+ "description": "Detect the dominant newline character of a string",
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "files": [
+ "index.js"
+ ],
+ "homepage": "https://github.com/sindresorhus/detect-newline#readme",
+ "keywords": [
+ "newline",
+ "linebreak",
+ "line-break",
+ "line",
+ "lf",
+ "crlf",
+ "eol",
+ "linefeed",
+ "character",
+ "char"
+ ],
+ "license": "MIT",
+ "name": "detect-newline",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sindresorhus/detect-newline.git"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "version": "2.1.0"
+}
diff --git a/deps/npm/node_modules/detect-newline/readme.md b/deps/npm/node_modules/detect-newline/readme.md
new file mode 100644
index 0000000000..ec5a479e76
--- /dev/null
+++ b/deps/npm/node_modules/detect-newline/readme.md
@@ -0,0 +1,42 @@
+# detect-newline [![Build Status](https://travis-ci.org/sindresorhus/detect-newline.svg?branch=master)](https://travis-ci.org/sindresorhus/detect-newline)
+
+> Detect the dominant newline character of a string
+
+
+## Install
+
+```
+$ npm install --save detect-newline
+```
+
+
+## Usage
+
+```js
+const detectNewline = require('detect-newline');
+
+detectNewline('foo\nbar\nbaz\r\n');
+//=> '\n'
+```
+
+
+## API
+
+### detectNewline(input)
+
+Returns detected newline or `null` when no newline character is found.
+
+### detectNewline.graceful(input)
+
+Returns detected newline or `\n` when no newline character is found.
+
+
+## Related
+
+- [detect-newline-cli](https://github.com/sindresorhus/detect-newline-cli) - CLI for this module
+- [detect-indent](https://github.com/sindresorhus/detect-indent) - Detect the indentation of code
+
+
+## License
+
+MIT © [Sindre Sorhus](http://sindresorhus.com)