-
Notifications
You must be signed in to change notification settings - Fork 1
Description
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.
Metadata
Metadata
Assignees
Type
Projects
Status