Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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).