stamina-api
Version:
Npm module can make jokes generator and other. This module is for Stamina website and game. - Only Stamina's developpers: Can manage Stamina's infrastructure.
41 lines (35 loc) • 1.22 kB
JavaScript
var top = [
' █████████████████████████████',
' ║ ║',
' ║ Stamina package update: ║'
].join('\n');
var bottom = [
' ║ ╔════╗ ║',
' ║ ║ OK ║ ║',
' ║ ╚════╝ ║',
' ╚═══════════════════════════╝'
].join('\n');
var innerWidth = 27;
function buildLine(txts) {
return txts.reduce(function (total, txt) {
var before = Math.floor((innerWidth - txt.length) / 2);
var after = innerWidth - txt.length - before;
var line = ' ║' + (new Array(before +1)).join(' ') + txt + (new Array(after +1)).join(' ') + '║';
total.push(line);
return total;
}, []).join('\n');
}
function split(msg) {
var result = [];
result.push(msg);
return result;
}
function update() {
console.alert = function (msg) {
var middle = buildLine(split(msg));
console.log([top, middle, bottom].join('\n'));
};
};
module.exports = {
update: update
}