From 291803c31f829fe0d32bb3207bc11def95a7408c Mon Sep 17 00:00:00 2001 From: Nevena Bojovic Date: Tue, 1 Mar 2022 20:05:50 +0100 Subject: Urađena test aplikacija. Povezan front i back. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Front/node_modules/indent-string/index.js | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 sandbox/testAppNevena/Front/node_modules/indent-string/index.js (limited to 'sandbox/testAppNevena/Front/node_modules/indent-string/index.js') diff --git a/sandbox/testAppNevena/Front/node_modules/indent-string/index.js b/sandbox/testAppNevena/Front/node_modules/indent-string/index.js new file mode 100644 index 00000000..e1ab804f --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/indent-string/index.js @@ -0,0 +1,35 @@ +'use strict'; + +module.exports = (string, count = 1, options) => { + options = { + indent: ' ', + includeEmptyLines: false, + ...options + }; + + if (typeof string !== 'string') { + throw new TypeError( + `Expected \`input\` to be a \`string\`, got \`${typeof string}\`` + ); + } + + if (typeof count !== 'number') { + throw new TypeError( + `Expected \`count\` to be a \`number\`, got \`${typeof count}\`` + ); + } + + if (typeof options.indent !== 'string') { + throw new TypeError( + `Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\`` + ); + } + + if (count === 0) { + return string; + } + + const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm; + + return string.replace(regex, options.indent.repeat(count)); +}; -- cgit v1.2.3