summaryrefslogtreecommitdiff
path: root/bin/wiki/ImportarDesdeURL/node_modules/strip-indent/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'bin/wiki/ImportarDesdeURL/node_modules/strip-indent/index.js')
-rw-r--r--bin/wiki/ImportarDesdeURL/node_modules/strip-indent/index.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/bin/wiki/ImportarDesdeURL/node_modules/strip-indent/index.js b/bin/wiki/ImportarDesdeURL/node_modules/strip-indent/index.js
new file mode 100644
index 00000000..c90b2659
--- /dev/null
+++ b/bin/wiki/ImportarDesdeURL/node_modules/strip-indent/index.js
@@ -0,0 +1,14 @@
+'use strict';
+module.exports = str => {
+ const match = str.match(/^[ \t]*(?=\S)/gm);
+
+ if (!match) {
+ return str;
+ }
+
+ // TODO: use spread operator when targeting Node.js 6
+ const indent = Math.min.apply(Math, match.map(x => x.length)); // eslint-disable-line
+ const re = new RegExp(`^[ \\t]{${indent}}`, 'gm');
+
+ return indent > 0 ? str.replace(re, '') : str;
+};