Skip to content

Commit

Permalink
Address PR issues from Bryan
Browse files Browse the repository at this point in the history
  • Loading branch information
goetzrrGit committed Oct 22, 2024
1 parent 933ea97 commit f547fe9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/utilities/sequence-editor/from-seq-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ function seqJsonVariableToSequence(
sequence += variables
.map(variable => {
const name = variable.name;
const type = variable.type ? ' ' + variable.type : '';
const enumName = variable.enum_name ? ' ' + variable.enum_name : '';
const type = variable.type ? ` ${variable.type}` : '';
const enumName = variable.enum_name ? ` ${variable.enum_name}` : '';
const allowableRanges = variable.allowable_ranges
? ` "${variable.allowable_ranges.map(range => `${range.min}...${range.max}`).join(',')}"`
: '';
Expand Down
6 changes: 4 additions & 2 deletions src/utilities/sequence-editor/to-seq-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,10 @@ function parseAllowableRanges(text: string, rangeNode: any): { max: number; min:
const rangeMatch = /^([-+]?\d+)?(\.\.\.)([-+]?\d+)?$/.exec(range.replaceAll('"', '').trim());
if (rangeMatch) {
const [, min, , max] = rangeMatch;
const maxNum = !isNaN(Number(max)) ? Number(max) : Infinity;
const minNum = !isNaN(Number(min)) ? Number(min) : -Infinity;
const parsedMaxNum = Number(max);
const parsedMinNum = Number(min);
const maxNum = !Number.isNaN(parsedMaxNum) ? parsedMaxNum : Infinity;
const minNum = !Number.isNaN(parsedMinNum) ? parsedMinNum : -Infinity;

return { max: maxNum, min: minNum };
}
Expand Down

0 comments on commit f547fe9

Please sign in to comment.