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.3.1 to 0.4.0

precision.js

4

between.js

@@ -12,4 +12,4 @@ /**

module.exports = function(a, min, max){
module.exports = require('./wrap')(function(a, min, max){
return max > min ? Math.max(Math.min(a,max),min) : Math.max(Math.min(a,min),max);
};
});

@@ -9,6 +9,6 @@ var wrap = require('./wrap');

module.exports = {
between: wrap(require('./between')),
isBetween: wrap(require('./is-between')),
round: wrap(require('./round')),
getPrecision: require('./get-precision'),
between: require('./between'),
isBetween: require('./is-between'),
round: require('./round'),
precision: require('./precision'),
min: wrap(Math.min),

@@ -15,0 +15,0 @@ max: wrap(Math.max),

@@ -10,5 +10,5 @@ /**

*/
module.exports = function(a, left, right){
module.exports = require('./wrap')(function(a, left, right){
if (a <= right && a >= left) return true;
return false;
};
});
{
"name": "mumath",
"version": "0.3.1",
"version": "0.4.0",
"description": "Micro math methods: isBetween, between, getPrecition, toPrecision",

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

@@ -15,3 +15,3 @@ /**

module.exports = function(value, step) {
module.exports = require('./wrap')(function(value, step) {
if (step === 0) return value;

@@ -21,3 +21,3 @@ if (!step) return Math.round(value);

value = Math.round(value / step) * step;
return parseFloat(value.toFixed(getPrecision(step)));
};
return parseFloat(value.toFixed(require('./precision')(step)));
});

@@ -21,2 +21,6 @@ var m = require('../index');

assert.deepEqual(m.sub({top:10,bottom:20}, {top:5, bottom:5}), {top:5, bottom:15});
assert.deepEqual(m.add({top:10, bottom:20}, {top:5, bottom:5}), {top:15, bottom:25});
assert.deepEqual(m.add({top:10, bottom:20}, {top:5, bottom:5}), {top:15, bottom:25});
//precisions
assert.equal(m.precision(0.02), 2);
assert.equal(m.round(0.3, .5), .5);
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