X7ROOT File Manager
Current Path:
/lib/node_modules/npm/node_modules/gauge
lib
/
node_modules
/
npm
/
node_modules
/
gauge
/
ðŸ“
..
📄
CHANGELOG.md
(6.23 KB)
📄
LICENSE
(751 B)
📄
README.md
(14.72 KB)
📄
base-theme.js
(395 B)
📄
error.js
(616 B)
📄
has-color.js
(292 B)
📄
index.js
(6.83 KB)
ðŸ“
node_modules
📄
package.json
(2.13 KB)
📄
plumbing.js
(1.24 KB)
📄
process.js
(89 B)
📄
progress-bar.js
(998 B)
📄
render-template.js
(5.6 KB)
📄
set-immediate.js
(139 B)
📄
set-interval.js
(93 B)
📄
spin.js
(105 B)
📄
template-item.js
(1.86 KB)
📄
theme-set.js
(3.61 KB)
📄
themes.js
(1.51 KB)
📄
wide-truncate.js
(828 B)
Editing: wide-truncate.js
'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 }
Upload File
Create Folder