50 lines
4.1 KiB
JavaScript
50 lines
4.1 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
require("typings-global");
|
|
const plugins = require("./beautylog.plugins");
|
|
let defaultOptions = {
|
|
font: 'Star Wars',
|
|
color: 'green',
|
|
cb: function () { }
|
|
};
|
|
exports.figlet = function (textArg, optionsArg) {
|
|
let done = plugins.q.defer();
|
|
let mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
|
|
let options = plugins.lodash.assign(mergeOptions, optionsArg);
|
|
plugins.figlet(textArg, {
|
|
font: options.font,
|
|
horizontalLayout: 'default',
|
|
verticalLayout: 'default'
|
|
}, function (err, data) {
|
|
if (err) {
|
|
console.log('Something went wrong...');
|
|
console.dir(err);
|
|
return;
|
|
}
|
|
console.log(colorFiglet(data, options.color));
|
|
options.cb();
|
|
done.resolve();
|
|
});
|
|
return done.promise;
|
|
};
|
|
exports.figletSync = function (textArg, optionsArg) {
|
|
let mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
|
|
let options = plugins.lodash.assign(mergeOptions, optionsArg);
|
|
let figletString = plugins.figlet.textSync(textArg, {
|
|
font: options.font,
|
|
horizontalLayout: 'default',
|
|
verticalLayout: 'default'
|
|
});
|
|
console.log(colorFiglet(figletString, options.color));
|
|
return true;
|
|
};
|
|
let colorFiglet = (figletStringArg, colorArg) => {
|
|
let figletArray = figletStringArg.split('\n');
|
|
let figletStringCombined = '';
|
|
for (let figletRow of figletArray) {
|
|
figletRow = plugins.beautycolor.coloredString(figletRow, colorArg);
|
|
figletStringCombined = figletStringCombined + figletRow + '\n';
|
|
}
|
|
return figletStringCombined;
|
|
};
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmZpZ2xldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5maWdsZXQudHMiXSwibmFtZXMiOltdLCJtYXBw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