smartlog-destination-local/dist/beautylog.figlet.js
2017-01-21 01:05:28 +01:00

39 lines
3.0 KiB
JavaScript

"use strict";
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(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);
console.log(plugins.figlet.textSync(textArg, {
font: options.font,
horizontalLayout: 'default',
verticalLayout: 'default'
})[options.color]);
return true;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmZpZ2xldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5maWdsZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUN2QiwrQ0FBK0M7QUFDL0MsSUFBSSxjQUFjLEdBQUc7SUFDakIsSUFBSSxFQUFFLFdBQVc7SUFDakIsS0FBSyxFQUFFLE9BQU87SUFDZCxFQUFFLEVBQUUsY0FBWSxDQUFDO0NBQ3BCLENBQUE7QUFFVSxRQUFBLE1BQU0sR0FBRyxVQUFTLE9BQWUsRUFBRSxVQUFXO0lBQ3JELElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUE7SUFDNUIsSUFBSSxZQUFZLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxTQUF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