Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binjospookie/math-interval-functions
A tiny (119 bytes) and blazing fast solution for operations on intervals.
https://github.com/binjospookie/math-interval-functions
Last synced: about 1 month ago
JSON representation
A tiny (119 bytes) and blazing fast solution for operations on intervals.
- Host: GitHub
- URL: https://github.com/binjospookie/math-interval-functions
- Owner: binjospookie
- License: mit
- Created: 2020-04-15T14:34:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T04:42:08.000Z (almost 2 years ago)
- Last Synced: 2024-10-07T20:15:12.203Z (2 months ago)
- Language: TypeScript
- Homepage:
- Size: 1.13 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-blazingly-fast - math-interval-functions - A tiny (119 bytes) and blazing fast solution for operations on intervals. (TypeScript)
README
# math-interval-functions
![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555)
![Version](https://badgen.net/npm/v/math-interval-functions)
![CI](https://github.com/binjospookie/math-interval-functions/workflows/Build/badge.svg)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
```javascript
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
```