smartlog-destination-local/dist/beautylog.figlet.js

41 lines
4.8 KiB
JavaScript

"use strict";
require("typings-global");
var plugins = require("./beautylog.plugins");
var defaultOptions = {
font: "Star Wars",
color: "green",
cb: function () { }
};
exports.figlet = function (textArg, optionsArg) {
var done = plugins.q.defer();
var mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
var 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(data[options.color]);
options.cb();
done.resolve();
});
return done.promise;
};
exports.figletSync = function (textArg, optionsArg) {
var mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
var options = plugins.lodash.assign(mergeOptions, optionsArg);
console.log(plugins.figlet.textSync(textArg, {
font: options.font,
horizontalLayout: 'default',
verticalLayout: 'default'
})[options.color]);
return true;
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5maWdsZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFPLE9BQU8sV0FBVyxxQkFBcUIsQ0FBQyxDQUFDO0FBQ2hELElBQUksY0FBYyxHQUFHO0lBQ2pCLElBQUksRUFBQyxXQUFXO0lBQ2hCLEtBQUssRUFBRSxPQUFPO0lBQ2QsRUFBRSxFQUFFLGNBQVcsQ0FBQztDQUNuQixDQUFDO0FBRVMsY0FBTSxHQUFHLFVBQVMsT0FBYyxFQUFDLFVBQVc7SUFDbkQsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixJQUFJLFlBQVksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLFNBQVMsQ0FBQyxjQUFjLENBQUMsQ0FBQztJQUM1R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