Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range project #107

Open
jdbruijn opened this issue Mar 13, 2021 · 0 comments
Open

Range project #107

jdbruijn opened this issue Mar 13, 2021 · 0 comments

Comments

@jdbruijn
Copy link
Member

npm package @vidavidorra/range.

I ran into this while working on the platform scripts for device list. I wanted to have a CLI argument that can be used to specify the minimum or maximum measurement interval, but don't particularly like multiple arguments for that. I thought using a range, like semver, would be very nice there. After thinking about it, not only for numbers, but also for dates and perhaps other types.
It'd be useful if this also provides a Joi extension, but not yet sure if that would best be in the same package or in a separate package as @vidavidorra/joi-extension-range. I'm leaning towards the latter, for better visibility to the public.

This would be strongly based on semver's ranges. I want to be able to use similar syntax for for number and Date items, where I can write filter strings like >=600, >20 <=80, <2020-03-01 and >=2020-01-01 <2020-02-10.

It should support:

  • Dates, using Moment.js;
  • Numbers;
  • Strings (not sure about this yet).

It should have comparators:

  • < less than;
  • <= less than or equal to;
  • = equal;
  • >= greater than or equal to;
  • > greater than.

Without a comparator, = would be assumed.

@jdbruijn jdbruijn transferred this issue from another repository Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: todo 📝
Roadmap
Q4 2021
Development

No branches or pull requests

1 participant