Server IP : 192.250.235.76 / Your IP : 45.90.210.12
System : Linux s2968.sgp1.stableserver.net 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
PHP Version : 8.2.29
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
1902120114081995
Server IP : 198.54.116.172 / Your IP : 216.73.216.36
System : Linux server322.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : mail
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Upload Files :
Command :
Current File : /usr/lib/node_modules/npm/node_modules/gauge//template-item.js
'use strict'
var stringWidth = require('string-width')
module.exports = TemplateItem
function isPercent (num) {
if (typeof num !== 'string') return false
return num.slice(-1) === '%'
}
function percent (num) {
return Number(num.slice(0, -1)) / 100
}
function TemplateItem (values, outputLength) {
this.overallOutputLength = outputLength
this.finished = false
this.type = null
this.value = null
this.length = null
this.maxLength = null
this.minLength = null
this.kerning = null
this.align = 'left'
this.padLeft = 0
this.padRight = 0
this.index = null
this.first = null
this.last = null
if (typeof values === 'string') {
this.value = values
} else {
for (var prop in values) this[prop] = values[prop]
}
// Realize percents
if (isPercent(this.length)) {
this.length = Math.round(this.overallOutputLength * percent(this.length))
}
if (isPercent(this.minLength)) {
this.minLength = Math.round(this.overallOutputLength * percent(this.minLength))
}
if (isPercent(this.maxLength)) {
this.maxLength = Math.round(this.overallOutputLength * percent(this.maxLength))
}
return this
}
TemplateItem.prototype = {}
TemplateItem.prototype.getBaseLength = function () {
var length = this.length
if (length == null && typeof this.value === 'string' && this.maxLength == null && this.minLength == null) {
length = stringWidth(this.value)
}
return length
}
TemplateItem.prototype.getLength = function () {
var length = this.getBaseLength()
if (length == null) return null
return length + this.padLeft + this.padRight
}
TemplateItem.prototype.getMaxLength = function () {
if (this.maxLength == null) return null
return this.maxLength + this.padLeft + this.padRight
}
TemplateItem.prototype.getMinLength = function () {
if (this.minLength == null) return null
return this.minLength + this.padLeft + this.padRight
}
Name
Size
Last Modified
Owner / Group
Permissions
Options
.. -- March 03 2024 22:36:29 root / root 0755 node_modules -- March 03 2024 22:36:28 root / root 0755 CHANGELOG.md 6.227 KB March 10 2021 14:36:39 root / root 0644 LICENSE 0.733 KB March 10 2021 14:36:39 root / root 0644 README.md 14.72 KB March 10 2021 14:36:39 root / root 0644 base-theme.js 0.386 KB March 10 2021 14:36:39 root / root 0644 error.js 0.602 KB March 10 2021 14:36:39 root / root 0644 has-color.js 0.285 KB March 10 2021 14:36:39 root / root 0644 index.js 6.835 KB March 10 2021 14:36:39 root / root 0644 package.json 2.13 KB March 10 2021 14:36:39 root / root 0644 plumbing.js 1.239 KB March 10 2021 14:36:39 root / root 0644 process.js 0.087 KB March 10 2021 14:36:39 root / root 0644 progress-bar.js 0.975 KB March 10 2021 14:36:39 root / root 0644 render-template.js 5.604 KB March 10 2021 14:36:39 root / root 0644 set-immediate.js 0.136 KB March 10 2021 14:36:39 root / root 0644 set-interval.js 0.091 KB March 10 2021 14:36:39 root / root 0644 spin.js 0.103 KB March 10 2021 14:36:39 root / root 0644 template-item.js 1.859 KB March 10 2021 14:36:39 root / root 0644 theme-set.js 3.606 KB March 10 2021 14:36:39 root / root 0644 themes.js 1.507 KB March 10 2021 14:36:39 root / root 0644 wide-truncate.js 0.809 KB March 10 2021 14:36:39 root / root 0644