Conversation
| * | ||
| */ | ||
| function isNumber(content: string): boolean { | ||
| return new RegExp(/^\d+$/).test(content); |
There was a problem hiding this comment.
remove RegExp
/^\d+$/.test(content)
| * | ||
| */ | ||
| function hasWhiteSpaces(version: string): boolean { | ||
| return new RegExp(/\s/).test(version); |
| * @return {boolean} The array of version split into smaller parts i.e major, minor, patch etc | ||
| * null if given version is in invalid format | ||
| */ | ||
| function splitVersion(version: string): string[] | null { |
There was a problem hiding this comment.
@mjc1283 I think, parsing condition would be bit difficult if we return SemVer interface like you said in the comment.
One of the reason, we are allowing all variations. Version can have the following forms.
major
major.minor
major.minor.patch
major.minor.patch.pre-release
major.minor.patch.pre-release+build
major.minor.patch+build
| * null if invalid user or condition version is provided | ||
| */ | ||
| export function compareVersion(conditionsVersion: string, userProvidedVersion: string): number | null { | ||
| const isPreReleaseInconditionsVersion = isPreReleaseVersion(conditionsVersion); |
There was a problem hiding this comment.
I think we don't really need this variable, let me think. btw
x isPreReleaseInConditionsVersion
| * false if values are not valid | ||
| */ | ||
| function greaterThanEvaluator(condition: Condition, userAttributes: UserAttributes): boolean | null { | ||
| function validateValues(condition: Condition, userAttributes: UserAttributes): boolean { |
There was a problem hiding this comment.
| function validateValues(condition: Condition, userAttributes: UserAttributes): boolean { | |
| function validateValuesForNumericCondition(condition: Condition, userAttributes: UserAttributes): boolean { |
| @@ -0,0 +1,190 @@ | |||
| /** | |||
There was a problem hiding this comment.
This file has several style/formatting issues. Please see other files and follow the same style for indentation, brackets on the same line as if statements, always use brackets with if statements. I will try update the linter to enforce these.
Summary
Test plan