math-interval-functions
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

math-interval-functions

Typed with TypeScript Version CI

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 }); // false
inInterval({ interval: '[1,5)', value: 1 }); // true
inInterval({ interval: '[1,5)', value: 5 }); // false
inInterval({ interval: '[1,5]', value: 5 }); // true
inInterval({ interval: '(1,5]', value: 5 }); // true
inInterval({ interval: '(,5]', value: 5 }); // true
inInterval({ interval: '(,5]', value: 1 }); // true
inInterval({ interval: '123jkvb12h3b12h3', value: 1 }); // false
inInterval({ interval: '[-10,0]', value: -5 }); // true
inInterval({ interval: '[-10,0]', value: 1 }); // false

Addition

WIP

Subtraction

WIP

Multiplication

WIP

Division

WIP

Benchmarks

inInterval: 10,200,104 ops/sec

Package Sidebar

Install

npm i math-interval-functions

Weekly Downloads

11

Version

1.0.3

License

MIT

Unpacked Size

6.85 kB

Total Files

8

Last publish

Collaborators

  • binjospookie