[Pkg-javascript-commits] [node-repeating] 01/05: Import Upstream version 3.0.0

Sruthi Chandran srud-guest at moszumanska.debian.org
Tue Oct 25 06:16:35 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-repeating.

commit 0e3e987b1b9b51e82e307f0d368347fc197f7cc4
Author: Sruthi <srud at disroot.org>
Date:   Tue Oct 25 11:20:22 2016 +0530

    Import Upstream version 3.0.0
---
 .editorconfig  | 12 ++++++++++++
 .gitattributes |  1 +
 .gitignore     |  1 +
 .travis.yml    |  5 +++++
 index.js       | 24 ++++++++++++++++++++++++
 license        | 21 +++++++++++++++++++++
 package.json   | 37 +++++++++++++++++++++++++++++++++++++
 readme.md      | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 test.js        | 14 ++++++++++++++
 9 files changed, 167 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..98a761d
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+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
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..b18bae5
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,5 @@
+sudo: false
+language: node_js
+node_js:
+  - '6'
+  - '4'
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..7a0400c
--- /dev/null
+++ b/index.js
@@ -0,0 +1,24 @@
+'use strict';
+module.exports = (n, str) => {
+	str = str === undefined ? ' ' : str;
+
+	if (typeof str !== 'string') {
+		throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof str}\``);
+	}
+
+	if (n < 0 || !Number.isFinite(n)) {
+		throw new TypeError(`Expected \`count\` to be a positive finite number, got \`${n}\``);
+	}
+
+	let ret = '';
+
+	do {
+		if (n & 1) {
+			ret += str;
+		}
+
+		str += str;
+	} while ((n >>= 1));
+
+	return ret;
+};
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..49d4702
--- /dev/null
+++ b/package.json
@@ -0,0 +1,37 @@
+{
+  "name": "repeating",
+  "version": "3.0.0",
+  "description": "Repeat a string - fast",
+  "license": "MIT",
+  "repository": "sindresorhus/repeating",
+  "author": {
+    "name": "Sindre Sorhus",
+    "email": "sindresorhus at gmail.com",
+    "url": "sindresorhus.com"
+  },
+  "engines": {
+    "node": ">=4"
+  },
+  "scripts": {
+    "test": "xo && ava"
+  },
+  "files": [
+    "index.js"
+  ],
+  "keywords": [
+    "repeat",
+    "string",
+    "repeating",
+    "str",
+    "text",
+    "fill",
+    "pad"
+  ],
+  "devDependencies": {
+    "ava": "*",
+    "xo": "*"
+  },
+  "xo": {
+    "esnext": true
+  }
+}
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..4e44831
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,52 @@
+# repeating [![Build Status](https://travis-ci.org/sindresorhus/repeating.svg?branch=master)](https://travis-ci.org/sindresorhus/repeating)
+
+> Repeat a string - fast
+
+
+## Install
+
+```
+$ npm install --save repeating
+```
+
+
+## Usage
+
+```js
+const repeating = require('repeating');
+
+repeating(5);
+//=> '     '
+
+repeating(100, 'unicorn ');
+//=> 'unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicorn unicor [...]
+```
+
+
+## API
+
+### repeating(count, [string])
+
+#### count
+
+Type: `number`
+
+Times the `string` should be repeated.
+
+#### string
+
+Type: `string`<br>
+Default: `' '`
+
+String to repeat.
+
+
+## Related
+
+- [repeating-cli](https://github.com/sindresorhus/repeating-cli) - CLI for this module
+- [indent-string](https://github.com/sindresorhus/indent-string) - Indent each line in a string
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..3aa9823
--- /dev/null
+++ b/test.js
@@ -0,0 +1,14 @@
+import test from 'ava';
+import m from './';
+
+test('error', t => {
+	t.throws(() => m(5, 5), 'Expected `input` to be a `string`, got `number`');
+	t.throws(() => m(-5, 'foo'), 'Expected `count` to be a positive finite number, got `-5`');
+});
+
+test('repeating', t => {
+	t.is(m(5), '     ');
+	t.is(m(5, ''), '');
+	t.is(m(5, 'a'), 'aaaaa');
+	t.is(m(3, 'unicorn'), 'unicornunicornunicorn');
+});

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



More information about the Pkg-javascript-commits mailing list