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/gauge/lib/wide-truncate.js | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 sandbox/testAppNevena/Front/node_modules/gauge/lib/wide-truncate.js (limited to 'sandbox/testAppNevena/Front/node_modules/gauge/lib/wide-truncate.js') diff --git a/sandbox/testAppNevena/Front/node_modules/gauge/lib/wide-truncate.js b/sandbox/testAppNevena/Front/node_modules/gauge/lib/wide-truncate.js new file mode 100644 index 00000000..5284a699 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/gauge/lib/wide-truncate.js @@ -0,0 +1,31 @@ +'use strict' +var stringWidth = require('string-width') +var stripAnsi = require('strip-ansi') + +module.exports = wideTruncate + +function wideTruncate (str, target) { + if (stringWidth(str) === 0) { + return str + } + if (target <= 0) { + return '' + } + if (stringWidth(str) <= target) { + return str + } + + // We compute the number of bytes of ansi sequences here and add + // that to our initial truncation to ensure that we don't slice one + // that we want to keep in half. + var noAnsi = stripAnsi(str) + var ansiSize = str.length + noAnsi.length + var truncated = str.slice(0, target + ansiSize) + + // we have to shrink the result to account for our ansi sequence buffer + // (if an ansi sequence was truncated) and double width characters. + while (stringWidth(truncated) > target) { + truncated = truncated.slice(0, -1) + } + return truncated +} -- cgit v1.2.3