IntervalParts

An interval's two ends as written, and whether each one is in it.

@internote/canvas-sdkInterface
On this page
import { IntervalParts } from '@internote/canvas-sdk';

The brackets are decoration: [a, b] and (a, b) say the same thing, and either kind may be used as long as it balances — which is the whole reason this reads markers instead of brackets. [a, b) is the notation everyone knows and the compiler will not accept it: it counts brackets before it ever reaches an attribute value, and an unmatched [ ends the document.

So each END carries its own mark, and both combinations are writable:

  • [0, 8] is 0 ≤ x ≤ 8: an end with no mark is IN the interval.
  • [0, <8] is 0 ≤ x < 8: < is up to but not including.
  • [>0, 8] is 0 < x ≤ 8: > is from but not including.
  • [>0, <8] is 0 < x < 8.
  • [=0, 8] is 0 ≤ x ≤ 8: = says "and equal to", if you want it said.

An end left empty is unbounded, which is how a one-sided interval is written — the mark on the end that IS there still applies:

  • [, =4] is x ≤ 4: everything up to and including 4.
  • [, <4] is x < 4.
  • [=-5, ] is x ≥ -5.
  • [>-5, ] is x > -5.

Splitting is done by counting depth rather than by matching, so an endpoint may be any expression: [0, exp(1)] and [>k, <2 * k] both read.

#Fields

endRequired
The upper end as written, or inf where it was left empty.
string
inclusiveEndRequired
Whether the upper end is in the interval — false for < and for an unbounded end.
boolean
inclusiveStartRequired
Whether the lower end is in the interval — false for > and for an unbounded end.
boolean
startRequired
The lower end as written, or -inf where it was left empty.
string

Declared in packages/canvas-sdk/src/refine/value-refiners.ts:69.

Last updated