math-interval-functions
A tiny (119 bytes) and blazing fast solution for operations on intervals.
Installation
npm i math-interval-functions
Functions
inInterval
Check that value belongs to the interval.
Examples
inInterval({ interval: '(1,5)', value: 1 });
inInterval({ interval: '[1,5)', value: 1 });
inInterval({ interval: '[1,5)', value: 5 });
inInterval({ interval: '[1,5]', value: 5 });
inInterval({ interval: '(1,5]', value: 5 });
inInterval({ interval: '(,5]', value: 5 });
inInterval({ interval: '(,5]', value: 1 });
inInterval({ interval: '123jkvb12h3b12h3', value: 1 });
inInterval({ interval: '[-10,0]', value: -5 });
inInterval({ interval: '[-10,0]', value: 1 });
Addition
WIP
Subtraction
WIP
Multiplication
WIP
Division
WIP
Benchmarks
inInterval: 10,200,104 ops/sec