Skip to content

Commit

Permalink
fix: Treat user input "version" as invalid for calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhas committed Oct 23, 2018
1 parent fe2841a commit d46641c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ts/input-validators/calculator-input-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import * as math from "mathjs";

export class CalculatorInputValidator implements InputValidator {
public isValidForSearchResults(userInput: string): boolean {
if (userInput.indexOf("version") > -1) {
return false;
}

let result: any;
try {
// Mathjs throws an error when input cannot be evaluated
Expand Down

0 comments on commit d46641c

Please sign in to comment.