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

1.1.0 • Public • Published

math-interval

Please have look at wikipedia if you don't know what it means.

Install

yarn add math-interval-2 or npm install --save math-interval-2

Big thanks to @npm for finding math-interval "too similar" to an existing package, that's why I had to suffix -2

Usage

import { MathInterval } from 'math-interval-2'

const interval = MathInterval.closedOpen(1, 5);
interval.contains(1) // true
interval.contains(3) // true
interval.contains(5) // false

const another = MathInterval.openClosed(4, 10);

interval.isConnectedTo(another) // true;
interval.encloses(another) // false
iterval.span(another) // [1, 10]
iterval.intersection(another) // (4, 5]

For more, please check tests and docs

Date support

For now you have to convert it to number with date.getTime(), see Date.prototype.getTime(), you can track the direct date support via #5.

Package Sidebar

Install

npm i math-interval-2

Weekly Downloads

2

Version

1.1.0

License

MIT

Unpacked Size

572 kB

Total Files

33

Last publish

Collaborators

  • harunurhan