Linted project with eslint
This commit is contained in:
@@ -1,29 +1,29 @@
|
||||
import FigletFonts from "../figletFonts";
|
||||
import IFigletOptions from "../interfaces/IFigletOptions";
|
||||
import FigletFonts from '../figletFonts';
|
||||
import IFigletOptions from '../interfaces/IFigletOptions';
|
||||
|
||||
const figletFonts = new FigletFonts()
|
||||
const figletFonts = new FigletFonts();
|
||||
|
||||
function generateCatOutput(data: string) {
|
||||
return Promise.resolve(`#!/bin/sh
|
||||
cat << 'EOF'
|
||||
${data}
|
||||
EOF
|
||||
`)
|
||||
`);
|
||||
}
|
||||
|
||||
const modtFontController = (req, res) => {
|
||||
const { text, font, width } = req.query;
|
||||
let options: IFigletOptions | Object = {};
|
||||
let options: IFigletOptions;
|
||||
if (font) options = { ...options, font };
|
||||
if (width) options = { ...options, width };
|
||||
|
||||
figletFonts.generateText(text, options as IFigletOptions)
|
||||
figletFonts.generateText(text, options)
|
||||
.then((data) => generateCatOutput(data))
|
||||
.then((motd) => res.send(motd))
|
||||
.catch((error) => {
|
||||
const msg = error?.message || "Unexpected error from generating motd figlet"
|
||||
res.status(error?.statusCode || 500).send(msg)
|
||||
const msg = error?.message || 'Unexpected error from generating motd figlet';
|
||||
res.status(error?.statusCode || 500).send(msg);
|
||||
});
|
||||
};
|
||||
|
||||
export default modtFontController;
|
||||
export default modtFontController;
|
||||
|
||||
Reference in New Issue
Block a user