404

[ Avaa Bypassed ]




Upload:

Command:

botdev@52.14.6.145: ~ $
'use strict'
var validate = require('aproba')
var renderTemplate = require('./render-template.js')
var wideTruncate = require('./wide-truncate')
var stringWidth = require('string-width')

module.exports = function (theme, width, completed) {
  validate('ONN', [theme, width, completed])
  if (completed < 0) completed = 0
  if (completed > 1) completed = 1
  if (width <= 0) return ''
  var sofar = Math.round(width * completed)
  var rest = width - sofar
  var template = [
    {type: 'complete', value: repeat(theme.complete, sofar), length: sofar},
    {type: 'remaining', value: repeat(theme.remaining, rest), length: rest}
  ]
  return renderTemplate(width, template, theme)
}

// lodash's way of repeating
function repeat (string, width) {
  var result = ''
  var n = width
  do {
    if (n % 2) {
      result += string
    }
    n = Math.floor(n / 2)
    /*eslint no-self-assign: 0*/
    string += string
  } while (n && stringWidth(result) < width)

  return wideTruncate(result, width)
}

Filemanager

Name Type Size Permission Actions
node_modules Folder 0755
CHANGELOG.md File 6.23 KB 0644
LICENSE File 751 B 0644
README.md File 14.72 KB 0644
base-theme.js File 395 B 0644
error.js File 616 B 0644
has-color.js File 292 B 0644
index.js File 6.83 KB 0644
package.json File 2.13 KB 0644
plumbing.js File 1.24 KB 0644
process.js File 89 B 0644
progress-bar.js File 998 B 0644
render-template.js File 5.6 KB 0644
set-immediate.js File 139 B 0644
set-interval.js File 93 B 0644
spin.js File 105 B 0644
template-item.js File 1.86 KB 0644
theme-set.js File 3.61 KB 0644
themes.js File 1.51 KB 0644
wide-truncate.js File 828 B 0644