[Pkg-javascript-commits] [node-trim-newlines] 01/05: Import Upstream version 1.0.0

Sruthi Chandran srud-guest at moszumanska.debian.org
Tue Oct 25 07:05:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

srud-guest pushed a commit to branch master
in repository node-trim-newlines.

commit 5af4d0470deebd82f866c05aeddf9240c621e738
Author: Sruthi <srud at disroot.org>
Date:   Tue Oct 25 12:08:21 2016 +0530

    Import Upstream version 1.0.0
---
 .editorconfig  | 15 +++++++++++++++
 .gitattributes |  1 +
 .gitignore     |  1 +
 .travis.yml    |  5 +++++
 index.js       | 13 +++++++++++++
 license        | 21 +++++++++++++++++++++
 package.json   | 42 ++++++++++++++++++++++++++++++++++++++++++
 readme.md      | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 test.js        | 28 ++++++++++++++++++++++++++++
 9 files changed, 172 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..8f9d77e
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,15 @@
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[{package.json,*.yml}]
+indent_style = space
+indent_size = 2
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..176a458
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..2a2f1c6
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+  - 'stable'
+  - '0.12'
+  - '0.10'
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..da31efd
--- /dev/null
+++ b/index.js
@@ -0,0 +1,13 @@
+'use strict';
+
+var fn = module.exports = function (x) {
+	return fn.end(fn.start(x));
+};
+
+fn.start = function (x) {
+	return x.replace(/^[\r\n]+/, '');
+};
+
+fn.end = function (x) {
+	return x.replace(/[\r\n]+$/, '');
+};
diff --git a/license b/license
new file mode 100644
index 0000000..654d0bf
--- /dev/null
+++ b/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus at 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/package.json b/package.json
new file mode 100644
index 0000000..c0bca90
--- /dev/null
+++ b/package.json
@@ -0,0 +1,42 @@
+{
+  "name": "trim-newlines",
+  "version": "1.0.0",
+  "description": "Trim newlines from the start and/or end of a string",
+  "license": "MIT",
+  "repository": "sindresorhus/trim-newlines",
+  "author": {
+    "name": "Sindre Sorhus",
+    "email": "sindresorhus at gmail.com",
+    "url": "sindresorhus.com"
+  },
+  "engines": {
+    "node": ">=0.10.0"
+  },
+  "scripts": {
+    "test": "xo && ava"
+  },
+  "files": [
+    "index.js"
+  ],
+  "keywords": [
+    "trim",
+    "newline",
+    "newlines",
+    "linebreak",
+    "lf",
+    "crlf",
+    "left",
+    "right",
+    "start",
+    "end",
+    "string",
+    "str",
+    "remove",
+    "delete",
+    "strip"
+  ],
+  "devDependencies": {
+    "ava": "*",
+    "xo": "*"
+  }
+}
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..fedb3ca
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,46 @@
+# trim-newlines [![Build Status](https://travis-ci.org/sindresorhus/trim-newlines.svg?branch=master)](https://travis-ci.org/sindresorhus/trim-newlines)
+
+> Trim [newlines](https://en.wikipedia.org/wiki/Newline) from the start and/or end of a string
+
+
+## Install
+
+```
+$ npm install --save trim-newlines
+```
+
+
+## Usage
+
+```js
+var trimNewlines = require('trim-newlines');
+
+trimNewlines('\nunicorn\r\n');
+//=> 'unicorn'
+```
+
+
+## API
+
+### trimNewlines(input)
+
+Trim from the start and end of a string.
+
+### trimNewlines.start(input)
+
+Trim from the start of a string.
+
+### trimNewlines.end(input)
+
+Trim from the end of a string.
+
+
+## Related
+
+- [trim-left](https://github.com/sindresorhus/trim-left) - Similar to `String#trim()` but removes only whitespace on the left
+- [trim-right](https://github.com/sindresorhus/trim-right) - Similar to `String#trim()` but removes only whitespace on the right.
+
+
+## License
+
+MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..ec9529d
--- /dev/null
+++ b/test.js
@@ -0,0 +1,28 @@
+import test from 'ava';
+import fn from './';
+
+test('main', t => {
+	t.is(fn('\nx\n'), 'x');
+	t.is(fn('\n\n\nx\n\n\n'), 'x');
+	t.is(fn('\r\nx\r\n'), 'x');
+	t.is(fn('\n\r\n\nx\n\r\n\n'), 'x');
+	t.end();
+});
+
+test('start', t => {
+	t.is(fn.start('\nx'), 'x');
+	t.is(fn.start('\r\nx'), 'x');
+	t.is(fn.start('\n\n\n\nx'), 'x');
+	t.is(fn.start('\n\n\r\n\nx'), 'x');
+	t.is(fn.start('x\n\n\r\n\n'), 'x\n\n\r\n\n');
+	t.end();
+});
+
+test('end', t => {
+	t.is(fn.end('x\n'), 'x');
+	t.is(fn.end('x\r\n'), 'x');
+	t.is(fn.end('x\n\n\n\n'), 'x');
+	t.is(fn.end('x\n\n\r\n\n'), 'x');
+	t.is(fn.end('\n\n\r\n\nx'), '\n\n\r\n\nx');
+	t.end();
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-trim-newlines.git



More information about the Pkg-javascript-commits mailing list