Skip to content

feat(condition): Add Number Greater Than Inspector#183

Merged
jshlbrd merged 5 commits intomainfrom
jshlbrd/feat/num-gt
Jun 21, 2024
Merged

feat(condition): Add Number Greater Than Inspector#183
jshlbrd merged 5 commits intomainfrom
jshlbrd/feat/num-gt

Conversation

@jshlbrd
Copy link
Contributor

@jshlbrd jshlbrd commented Jun 18, 2024

Description

  • Adds number_greater_than inspector

Motivation and Context

This is for comparing a number's value, which is currently only possible using the string_match function like this:

sub.cnd.str.match({ object: {source_key: 'FIELD'}, pattern: '^[0-9]{4,}$'}),  // 1,000+

This inspector is simpler to understand:

sub.cnd.num.greater_than({ object: {source_key: 'FIELD'}, value: 999 }),  // 1,000+

The target value type is float64, but this works just as well with integers.

Additional functions can be added later (e.g. equal_to, less_than). This is nested directly under the number.* tree to mimic the naming convention of the string.* functions. This probably needs to be considered along with #64, which could either be a new set of nested functions (e.g. string.compare.equal_to, number.compare.less_than) or be added to existing functions (e.g., if object.target_key exists, then it overrides value).

How Has This Been Tested?

Added new unit tests.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@jshlbrd jshlbrd marked this pull request as ready for review June 20, 2024 23:08
@jshlbrd jshlbrd requested a review from a team as a code owner June 20, 2024 23:08
@jshlbrd jshlbrd mentioned this pull request Jun 21, 2024
@jshlbrd jshlbrd merged commit ff966ba into main Jun 21, 2024
@jshlbrd jshlbrd deleted the jshlbrd/feat/num-gt branch June 21, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants