New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@feldhaus/math

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@feldhaus/math

A simple math utility library

Source
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

@feldhaus/math

A lightweight math utility library that provides commonly used mathematical functions for JavaScript and TypeScript applications.

Installation

You can install the package via npm:

npm install @feldhaus/math

Available Functions

  • clamp: Clamps a number between a minimum and maximum value. Source
  • inverseLerp: Calculates the relative position of a value within a range. Source
  • lerp: Linearly interpolates between two values. Source

Available Constants

  • RAD2DEG: Conversion factor from radians to degrees 180 / Math.PI.
  • DEG2RAD: Conversion factor from degrees to radians Math.PI / 180.
  • HALF_PI: Half of Pi (π/2) Math.PI / 2.
  • QUARTER_PI: Quarter of Pi (π/4) Math.PI / 4.
  • TWO_PI: Two times Pi (2π) Math.PI * 2.
  • TAU: Tau, which is equivalent to 2π Math.PI * 2.

Examples

import { clamp } from '@feldhaus/math';

const clampedValue = clamp(5, 1, 10); // Output: 5
import { DEG2RAD } from '@feldhaus/math';

const radians = DEG2RAD * 45; // Output: 0.7853981633974483
import { inverseLerp } from '@feldhaus/math';

const relativeValue = inverseLerp(10, 20, 15); // Output: 0.5
import { lerp } from '@feldhaus/math';

const interpolatedValue = lerp(0, 10, 0.5); // Output: 5

License

MIT

Keywords

math

FAQs

Package last updated on 01 Mar 2025

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