missing-math

3.4.0 • Public • Published

missing-math

missing features of the Math built-in object


Usage

Import with a module bundler
$ npm install --save missing-math
// using ES6 module
import { clamp, degrees } from 'missing-math'

// using CommonJS module
var { clamp, degrees } = require('missing-math')
Import from a browser
<script src="https://unpkg.com/missing-math"></script>
<script>
  // all methods are exposed in window.MissingMath
  MissingMath.clamp()
  MissingMath.degrees()
</script>

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.

Readme

Keywords

none

Package Sidebar

Install

npm i missing-math

Weekly Downloads

2

Version

3.4.0

License

MIT

Unpacked Size

14.7 kB

Total Files

9

Last publish

Collaborators

  • arnaudjuracek