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

Practical math utils for components

  • 3.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
167K
decreased by-18.73%
Maintainers
1
Weekly downloads
 
Created

What is mumath?

The mumath npm package provides a collection of mathematical utilities for common operations such as rounding, clamping, and interpolation. It is designed to be lightweight and easy to use for basic mathematical tasks.

What are mumath's main functionalities?

Rounding

The rounding feature allows you to round numbers to the nearest integer. The code sample demonstrates rounding 4.6 up to 5 and 4.4 down to 4.

const mumath = require('mumath');

console.log(mumath.round(4.6)); // 5
console.log(mumath.round(4.4)); // 4

Clamping

The clamping feature restricts a number to be within a specified range. The code sample shows clamping 10 to the maximum value of 5 and -1 to the minimum value of 0.

const mumath = require('mumath');

console.log(mumath.clamp(10, 0, 5)); // 5
console.log(mumath.clamp(-1, 0, 5)); // 0

Interpolation

The interpolation feature allows you to find a value at a specific point between two numbers. The code sample demonstrates finding the midpoint (0.5) between 0 and 10, which is 5.

const mumath = require('mumath');

console.log(mumath.lerp(0, 10, 0.5)); // 5

Other packages similar to mumath

Keywords

FAQs

Package last updated on 08 Mar 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc