aboutsummaryrefslogtreecommitdiff
path: root/node_modules/strip-indent
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
commitabd94a7f5a50f43c797a11b53549ae48fff667c3 (patch)
treeab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/strip-indent
parenta0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff)
downloadwallet-core-abd94a7f5a50f43c797a11b53549ae48fff667c3.tar.xz
add node_modules to address #4364
Diffstat (limited to 'node_modules/strip-indent')
-rwxr-xr-xnode_modules/strip-indent/cli.js49
-rw-r--r--node_modules/strip-indent/index.js16
-rw-r--r--node_modules/strip-indent/license21
-rw-r--r--node_modules/strip-indent/package.json109
-rw-r--r--node_modules/strip-indent/readme.md61
5 files changed, 256 insertions, 0 deletions
diff --git a/node_modules/strip-indent/cli.js b/node_modules/strip-indent/cli.js
new file mode 100755
index 000000000..bcd5f8d17
--- /dev/null
+++ b/node_modules/strip-indent/cli.js
@@ -0,0 +1,49 @@
+#!/usr/bin/env node
+'use strict';
+var fs = require('fs');
+var stdin = require('get-stdin');
+var pkg = require('./package.json');
+var stripIndent = require('./');
+var argv = process.argv.slice(2);
+var input = argv[0];
+
+function help() {
+ console.log([
+ '',
+ ' ' + pkg.description,
+ '',
+ ' Usage',
+ ' strip-indent <file>',
+ ' echo <string> | strip-indent',
+ '',
+ ' Example',
+ ' echo \'\\tunicorn\\n\\t\\tcake\' | strip-indent',
+ ' unicorn',
+ ' \tcake'
+ ].join('\n'));
+}
+
+function init(data) {
+ console.log(stripIndent(data));
+}
+
+if (argv.indexOf('--help') !== -1) {
+ help();
+ return;
+}
+
+if (argv.indexOf('--version') !== -1) {
+ console.log(pkg.version);
+ return;
+}
+
+if (process.stdin.isTTY) {
+ if (!input) {
+ help();
+ return;
+ }
+
+ init(fs.readFileSync(input, 'utf8'));
+} else {
+ stdin(init);
+}
diff --git a/node_modules/strip-indent/index.js b/node_modules/strip-indent/index.js
new file mode 100644
index 000000000..8f8f4f444
--- /dev/null
+++ b/node_modules/strip-indent/index.js
@@ -0,0 +1,16 @@
+'use strict';
+module.exports = function (str) {
+ var match = str.match(/^[ \t]*(?=\S)/gm);
+
+ if (!match) {
+ return str;
+ }
+
+ var indent = Math.min.apply(Math, match.map(function (el) {
+ return el.length;
+ }));
+
+ var re = new RegExp('^[ \\t]{' + indent + '}', 'gm');
+
+ return indent > 0 ? str.replace(re, '') : str;
+};
diff --git a/node_modules/strip-indent/license b/node_modules/strip-indent/license
new file mode 100644
index 000000000..654d0bfe9
--- /dev/null
+++ b/node_modules/strip-indent/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/node_modules/strip-indent/package.json b/node_modules/strip-indent/package.json
new file mode 100644
index 000000000..015d92d1b
--- /dev/null
+++ b/node_modules/strip-indent/package.json
@@ -0,0 +1,109 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "strip-indent@^1.0.1",
+ "scope": null,
+ "escapedName": "strip-indent",
+ "name": "strip-indent",
+ "rawSpec": "^1.0.1",
+ "spec": ">=1.0.1 <2.0.0",
+ "type": "range"
+ },
+ "/home/dold/repos/taler/wallet-webex/node_modules/redent"
+ ]
+ ],
+ "_from": "strip-indent@>=1.0.1 <2.0.0",
+ "_id": "strip-indent@1.0.1",
+ "_inCache": true,
+ "_location": "/strip-indent",
+ "_nodeVersion": "0.12.0",
+ "_npmUser": {
+ "name": "sindresorhus",
+ "email": "sindresorhus@gmail.com"
+ },
+ "_npmVersion": "2.5.1",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "strip-indent@^1.0.1",
+ "scope": null,
+ "escapedName": "strip-indent",
+ "name": "strip-indent",
+ "rawSpec": "^1.0.1",
+ "spec": ">=1.0.1 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/redent"
+ ],
+ "_resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz",
+ "_shasum": "0c7962a6adefa7bbd4ac366460a638552ae1a0a2",
+ "_shrinkwrap": null,
+ "_spec": "strip-indent@^1.0.1",
+ "_where": "/home/dold/repos/taler/wallet-webex/node_modules/redent",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "http://sindresorhus.com"
+ },
+ "bin": {
+ "strip-indent": "cli.js"
+ },
+ "bugs": {
+ "url": "https://github.com/sindresorhus/strip-indent/issues"
+ },
+ "dependencies": {
+ "get-stdin": "^4.0.1"
+ },
+ "description": "Strip leading whitespace from every line in a string",
+ "devDependencies": {
+ "mocha": "*"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "0c7962a6adefa7bbd4ac366460a638552ae1a0a2",
+ "tarball": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "files": [
+ "index.js",
+ "cli.js"
+ ],
+ "gitHead": "addcf90a56001ea122e9f1254987016bc87e5b5f",
+ "homepage": "https://github.com/sindresorhus/strip-indent",
+ "keywords": [
+ "cli",
+ "bin",
+ "browser",
+ "strip",
+ "normalize",
+ "remove",
+ "indent",
+ "indentation",
+ "whitespace",
+ "space",
+ "tab",
+ "string",
+ "str"
+ ],
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "sindresorhus",
+ "email": "sindresorhus@gmail.com"
+ }
+ ],
+ "name": "strip-indent",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sindresorhus/strip-indent.git"
+ },
+ "scripts": {
+ "test": "mocha"
+ },
+ "version": "1.0.1"
+}
diff --git a/node_modules/strip-indent/readme.md b/node_modules/strip-indent/readme.md
new file mode 100644
index 000000000..d622f03b0
--- /dev/null
+++ b/node_modules/strip-indent/readme.md
@@ -0,0 +1,61 @@
+# strip-indent [![Build Status](https://travis-ci.org/sindresorhus/strip-indent.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-indent)
+
+> Strip leading whitespace from every line in a string
+
+The line with the least number of leading whitespace, ignoring empty lines, determines the number to remove.
+
+Useful for removing redundant indentation.
+
+
+## Install
+
+```sh
+$ npm install --save strip-indent
+```
+
+
+## Usage
+
+```js
+var str = '\tunicorn\n\t\tcake';
+/*
+ unicorn
+ cake
+*/
+
+stripIndent('\tunicorn\n\t\tcake');
+/*
+unicorn
+ cake
+*/
+```
+
+
+## CLI
+
+```sh
+$ npm install --global strip-indent
+```
+
+```sh
+$ strip-indent --help
+
+ Usage
+ strip-indent <file>
+ echo <string> | strip-indent
+
+ Example
+ echo '\tunicorn\n\t\tcake' | strip-indent
+ unicorn
+ cake
+```
+
+
+## Related
+
+- [indent-string](https://github.com/sindresorhus/indent-string) - Indent each line in a string
+
+
+## License
+
+MIT © [Sindre Sorhus](http://sindresorhus.com)