Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arnaudjuracek/missing-math
missing features of the Math built-in object
https://github.com/arnaudjuracek/missing-math
javascript math
Last synced: 2 months ago
JSON representation
missing features of the Math built-in object
- Host: GitHub
- URL: https://github.com/arnaudjuracek/missing-math
- Owner: arnaudjuracek
- License: mit
- Created: 2017-01-01T14:18:03.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-08-24T13:31:37.000Z (over 2 years ago)
- Last Synced: 2024-10-06T12:18:02.475Z (3 months ago)
- Topics: javascript, math
- Language: JavaScript
- Homepage:
- Size: 127 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# missing-math
> missing features of the `Math` built-in object
## Usage
##### Import with a module bundler```console
$ npm install --save missing-math
```
```js
// using ES6 module
import { clamp, degrees } from 'missing-math'// using CommonJS module
var { clamp, degrees } = require('missing-math')
```##### Import from a browser
```html
// all methods are exposed in window.MissingMath
MissingMath.clamp()
MissingMath.degrees()```
## Methods
- `clamp(value, min, max)`
- `wrap(value, min, max)`
- `normalize(value, min, max[, clamp = false])`
- `map(value, in_min, in_max, out_min, out_max[, clamp = false])`
- `lerp(a, b, t)`
- `random(a[, b])`
- `degrees(radians)`
- `radians(degrees)`
- `roundTo(value, nearest)`
- `floorTo(value, nearest)`
- `fract(value[, decimals])`## License
[MIT](https://tldrlegal.com/license/mit-license).