| 523 | 523 | if (b === undefined) { |
| 524 | 524 | switch (rule) { |
| 525 | 525 | case undefined: |
| 526 | 526 | case 'not': { |
| 527 | 527 | const resultOnTruthy = rule !== 'not'; |
| 528 | 528 | if (isTrueBoolean(String(a))) return resultOnTruthy; |
| 529 | 529 | if (isFalseBoolean(String(a))) return !resultOnTruthy; |
| 530 | 530 | return !!a ? resultOnTruthy : !resultOnTruthy; |
| 531 | + } |
| 531 | 532 | default: |
| 532 | 533 | throw new Error(`Unknown boolean comparison rule for truthy check. If right operand is not provided, the rule must not provided or be 'not'. Provided: ${rule}`); |
| 533 | 534 | } |