From 5130a96edc3e75a4c6a66f9f5b525110f1e8da70 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Fri, 31 Mar 2023 17:53:24 +0200 Subject: [PATCH] apply linter --- src/console/input.js | 90 +++++++++++++++++++++---------------------- src/console/output.js | 54 +++++++++++++------------- src/filter/breaks.js | 2 +- src/filter/spaces.js | 2 +- src/filter/tags.js | 2 +- src/filter/trim.js | 2 +- 6 files changed, 76 insertions(+), 76 deletions(-) diff --git a/src/console/input.js b/src/console/input.js index 1aece10..eca2ebe 100644 --- a/src/console/input.js +++ b/src/console/input.js @@ -3,56 +3,56 @@ var Minimist = require('minimist'); class Input { - /** - * Constructor. - * - * @param object process - */ - constructor(process) { - this.args = Minimist(process.argv.slice(2)) - this.node = process.argv[0] - this.script = process.argv[1] + /** + * Constructor. + * + * @param object process + */ + constructor(process) { + this.args = Minimist(process.argv.slice(2)) + this.node = process.argv[0] + this.script = process.argv[1] + } + + /** + * Return the value of the given name argument. + * + * @param string name + * @param mixed default + * + * @return mixed + */ + get(name, defaultValue) { + if (this.has(name)) { + return this.args[name] } - /** - * Return the value of the given name argument. - * - * @param string name - * @param mixed default - * - * @return mixed - */ - get(name, defaultValue) { - if (this.has(name)) { - return this.args[name] - } - - if (defaultValue !== undefined) { - return defaultValue - } - - return null; + if (defaultValue !== undefined) { + return defaultValue } - /** - * Check the given argument name exists. - * - * @param string name - * - * @return boolean - */ - has(name) { - return this.args.hasOwnProperty(name) - } + return null; + } - /** - * Return if args is empty. - * - * @return boolean - */ - empty() { - return Object.keys(this.args).length === 1 - } + /** + * Check the given argument name exists. + * + * @param string name + * + * @return boolean + */ + has(name) { + return this.args.hasOwnProperty(name) + } + + /** + * Return if args is empty. + * + * @return boolean + */ + empty() { + return Object.keys(this.args).length === 1 + } } module.exports = Input diff --git a/src/console/output.js b/src/console/output.js index f03d121..381602d 100644 --- a/src/console/output.js +++ b/src/console/output.js @@ -1,37 +1,37 @@ "use strict"; class Output { - /** - * Convert and print data to json. - * - * @param mixed data - */ - json(data, pretty) { - data = JSON.stringify( - data, - function(key, value) { - if (value === undefined) { - return null - } + /** + * Convert and print data to json. + * + * @param mixed data + */ + json(data, pretty) { + data = JSON.stringify( + data, + function(key, value) { + if (value === undefined) { + return null + } - return value - }, - pretty ? 2 : null - ); + return value + }, + pretty ? 2 : null + ); - return this.write(data) - } + return this.write(data) + } - /** - * Print data. - * - * @param mixed data - */ - write(data, level) { - level = level || 'log' + /** + * Print data. + * + * @param mixed data + */ + write(data, level) { + level = level || 'log' - console[level](data) - } + console[level](data) + } } module.exports = Output diff --git a/src/filter/breaks.js b/src/filter/breaks.js index 48747d0..9bf73ab 100644 --- a/src/filter/breaks.js +++ b/src/filter/breaks.js @@ -1,5 +1,5 @@ const filter = function(value) { - return value.replace(/(\n|\r)/g, '') + return value.replace(/(\n|\r)/g, '') } module.exports = filter diff --git a/src/filter/spaces.js b/src/filter/spaces.js index dae7028..a088370 100644 --- a/src/filter/spaces.js +++ b/src/filter/spaces.js @@ -1,5 +1,5 @@ const filter = function(value) { - return value.replace(/\s{2,}/g, ' ') + return value.replace(/\s{2,}/g, ' ') } module.exports = filter diff --git a/src/filter/tags.js b/src/filter/tags.js index c303a04..764ab31 100644 --- a/src/filter/tags.js +++ b/src/filter/tags.js @@ -1,7 +1,7 @@ const striptags = require('striptags') const filter = function(value, tags) { - return striptags(value, tags) + return striptags(value, tags) } module.exports = filter diff --git a/src/filter/trim.js b/src/filter/trim.js index da9194c..3cf48eb 100644 --- a/src/filter/trim.js +++ b/src/filter/trim.js @@ -1,7 +1,7 @@ const trim = require('trim') const filter = function(value) { - return trim(value) + return trim(value) } module.exports = filter