Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mumath

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mumath - npm Package Compare versions

Comparing version 0.4.3 to 1.0.0

add.js

30

index.js

@@ -1,5 +0,3 @@

var wrap = require('./wrap');
/**
* Simple math utils.
* Composed set of all math utils
*

@@ -13,11 +11,19 @@ * @module mumath

precision: require('./precision'),
min: wrap(Math.min),
max: wrap(Math.max),
add: wrap(function(a,b){return a+b}),
sub: wrap(function(a,b){return a-b}),
div: wrap(function(a,b){return a/b}),
mult: wrap(function(a,b){return a*b}),
mod: wrap(function(a,b){return a%b}),
floor: wrap(function(a){return Math.floor(a)}),
ceil: wrap(function(a){return Math.ceil(a)})
loop: require('./loop'),
add: require('./add'),
sub: require('./sub'),
min: require('./min'),
max: require('./max'),
div: require('./div'),
mult: require('./mult'),
mod: require('./mod'),
floor: require('./floor'),
ceil: require('./ceil'),
gt: require('./gt'),
gte: require('./gte'),
lt: require('./lt'),
lte: require('./lte'),
eq: require('./eq'),
ne: require('./ne'),
};

2

package.json
{
"name": "mumath",
"version": "0.4.3",
"version": "1.0.0",
"description": "Micro math methods",

@@ -5,0 +5,0 @@ "main": "index.js",

/**
* @module mumath/precision
*
* Get precision from float:

@@ -7,3 +9,2 @@ *

*
*
* @param {number} n

@@ -10,0 +11,0 @@ *

# μMath [![Build Status](https://travis-ci.org/dfcreative/mumath.svg?branch=master)](https://travis-ci.org/dfcreative/mumath) [![Code Climate](https://codeclimate.com/github/dfcreative/mumath/badges/gpa.svg)](https://codeclimate.com/github/dfcreative/mumath) <a href="UNLICENSE"><img src="http://upload.wikimedia.org/wikipedia/commons/6/62/PD-icon.svg" width="20"/></a>
Common math functions aware of objects and arrays.
Each can be required as `require('mumath/<fn>')`;
Set of practical math utils to shorten code.
`$ npm install mumath`
```js
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](http://npmjs.org/package/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, ...)`
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](https://nodei.co/npm/mutype.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/mumath/)
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc