|
1 | 1 | import { IAlternative } from '../../@types/runes' |
2 | 2 |
|
3 | | -const punctuations = /[!"#\$%&'()*+-.\/:;<=>?@\[\\\]^`{|}~]/ |
| 3 | +const punctuations = /[!"#$%&'()*+-./:;<=>?@[\\\]^`{|}~]/ |
4 | 4 |
|
5 | 5 | const hasPunctuation = (input) => punctuations.test(input) |
6 | 6 |
|
@@ -54,19 +54,21 @@ export class Alternative implements IAlternative { |
54 | 54 | return why(values[this.field].includes(this.value), this.field, `does not contain ${this.value}`) |
55 | 55 | case '<': |
56 | 56 | case '>': |
57 | | - const actualInt = Number.parseInt(val) |
58 | | - if (Number.isNaN(actualInt)) { |
59 | | - return why(false, this.field, 'not an integer field') |
60 | | - } |
61 | | - const restrictionVal = Number.parseInt(this.value) |
62 | | - if (Number.isNaN(restrictionVal)) { |
63 | | - return why(false, this.field, 'not a valid integer') |
64 | | - } |
65 | | - |
66 | | - if (this.cond === '<') { |
67 | | - return why(actualInt < restrictionVal, this.field, `>= ${restrictionVal}`) |
68 | | - } else { |
69 | | - return why(actualInt > restrictionVal, this.field, `<= ${restrictionVal}`) |
| 57 | + { |
| 58 | + const actualInt = Number.parseInt(val) |
| 59 | + if (Number.isNaN(actualInt)) { |
| 60 | + return why(false, this.field, 'not an integer field') |
| 61 | + } |
| 62 | + const restrictionVal = Number.parseInt(this.value) |
| 63 | + if (Number.isNaN(restrictionVal)) { |
| 64 | + return why(false, this.field, 'not a valid integer') |
| 65 | + } |
| 66 | + |
| 67 | + if (this.cond === '<') { |
| 68 | + return why(actualInt < restrictionVal, this.field, `>= ${restrictionVal}`) |
| 69 | + } else { |
| 70 | + return why(actualInt > restrictionVal, this.field, `<= ${restrictionVal}`) |
| 71 | + } |
70 | 72 | } |
71 | 73 | case '{': |
72 | 74 | return why(val < this.value, this.field, `is the same or ordered after ${this.value}`) |
|
0 commit comments