Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
🎨 Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nagdahimanshu committed Oct 12, 2023
1 parent de2cfdf commit e513195
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/utils/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,12 @@ export const validateStartCommandParams = async (
for (let i = 0; i < userInputsArray.length; i += 1) {
const userInput = userInputsArray[i];
if (userInput.startsWith('-')) {
const isFlagExists = allowedFlags.find(e => e.split(/[\s=,]+/).includes(userInput));
if (!isFlagExists) throw new Error('Invalid Lisk Core command params.');
else if (
isFlagExists.includes(START_COMMAND_VALUE) ||
isFlagExists.includes(START_COMMAND_OPTION)
) {
const flag = allowedFlags.find(e => e.split(/[\s=,]+/).includes(userInput));
if (!flag) throw new Error('Invalid Lisk Core command params.');
else if (flag.includes(START_COMMAND_VALUE) || flag.includes(START_COMMAND_OPTION)) {
const value = userInputsArray[i + 1];
if (value.startsWith('-')) {
throw new Error(
`Lisk Core command:${isFlagExists} requires either a value or an option.`,
);
throw new Error(`Lisk Core command:${flag} requires either a value or an option.`);
}
}
}
Expand Down

0 comments on commit e513195

Please sign in to comment.