refactor: Simplifying logic, cleaning up code

This commit is contained in:
Jacob Nguyen
2022-05-08 22:26:10 -05:00
parent f760dbc6e3
commit e74976a72c
3 changed files with 4 additions and 7 deletions

View File

@@ -12,6 +12,5 @@ export async function editMain(name) {
output.main = name;
const result = () => writeFile(pjLocation, JSON.stringify(output, null, 2));
return result();
return writeFile(pjLocation, JSON.stringify(output, null, 2));
}

View File

@@ -2,9 +2,9 @@
import { init } from './commands/init.js';
const regex = /(?<=--|-)\w+/gm;
const flags = process.argv.slice(2).join(' ').match(regex);
const rawArgs = process.argv.slice(2);
const flags = rawArgs.join(' ').match(regex);
const args = rawArgs
.join(' ')
.trim()

View File

@@ -61,9 +61,7 @@ export const token = {
type: 'password',
validate: (/** @type {string} */ token) =>
token.match(
/(?<mfaToken>mfa\.[a-z0-9_-]{20,})|(?<basicToken>[a-z0-9_-]{23,28}\.[a-z0-9_-]{6,7}\.[a-z0-9_-]{27})/i
)?.length
(/(?<mfaToken>mfa\.[a-z0-9_-]{20,})|(?<basicToken>[a-z0-9_-]{23,28}\.[a-z0-9_-]{6,7}\.[a-z0-9_-]{27})/i).test(token)
? true
: 'Invalid token',
};