Skip to content

Commit

Permalink
🐛 Throw error instead of returning it
Browse files Browse the repository at this point in the history
  • Loading branch information
BetaHuhn committed May 2, 2021
1 parent 5160689 commit f40d15c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
15 changes: 5 additions & 10 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,13 @@ var parseBoolean = function (val) {
throw new Error('boolean input has to be one of \`true | True | TRUE | false | False | FALSE\`');
};
var parseValue = function (val, type) {
try {
if (type === 'array') {
return parseArray(val);
}
if (type === 'boolean') {
return parseBoolean(val);
}
return val.trim();
if (type === 'array') {
return parseArray(val);
}
catch (err) {
return err;
if (type === 'boolean') {
return parseBoolean(val);
}
return val.trim();
};
var getInput = function (key, opts) {
var parsedOptions;
Expand Down
18 changes: 7 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,15 @@ const parseBoolean = (val: string) => {
}

const parseValue = (val: string, type: string): InputValue => {
try {
if (type === 'array') {
return parseArray(val)
}

if (type === 'boolean') {
return parseBoolean(val)
}
if (type === 'array') {
return parseArray(val)
}

return val.trim()
} catch (err) {
return err
if (type === 'boolean') {
return parseBoolean(val)
}

return val.trim()
}

export const getInput = (key: string | IOpts, opts: IOpts): InputValue => {
Expand Down

0 comments on commit f40d15c

Please sign in to comment.