Socket
Socket
Sign inDemoInstall

mumath

Package Overview
Dependencies
0
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mumath

Practical math utils for components


Version published
Maintainers
1
Install size
8.51 kB
Created

Readme

Source

μMath Build Status Code Climate

Set of practical math utils to shorten code.

$ npm install mumath

	var round = require('mumath/round');
	round(123.32, .5); //123.5

	//require any function as
	//var <fn> = require('mumath/<fn>');

API

round(value, precision?)

Rounds value to optional precision, which is 1 by default.

precision(value)

Get precision from float:

1.1 → 1, 1234 → 0, .1234 → 4

between(value, left, right)

Return value clamped by left/right limits (or vice-versa).

isBetween(value, left, right)

Whether element is between left & right, including.

loop(value, [min,]? max)

An enhanced mod-loop - loops value within a frame.

mult(a, b, ...)

div(a, b, ...)

sub(a, b, ...)

add(a, b, ...)

mod(a, b, ...)

min(a, b, ...)

max(a, b, ...)

floor(a, b, ...)

ceil(a, b, ...)

log(a)

lg(a)

Simple wrappers for arythmetical functions.

gt(a,b)

gte(a,b)

lt(a,b)

lte(a,b)

eq(a,b)

ne(a,b)

Simple conditional functions.

NPM

Keywords

FAQs

Last updated on 12 May 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc