1.1.1 • Published 3 months ago

@everymundo/number-utils v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
3 months ago

@everymundo/number-utils

Utility library with useful functions to deal with common number tasks

Features

lib/boundaries

Whenever you want a variable numeric input to between 2 other values and if it is lower than the minimum it returns the minimum but if it is greater than the maximum it returns the maximum you can use this function

lib/boundaries Usage

const boundaries = require('@everymundo/number-utils/lib/boundaries')

// Let's say you are trusting an environmental variable to set some setting
// but if it is not there you want it to have a default value

// boundaries(input, MIN, MAX, defaultNumber)
const SOME_NUMBER = boundaries(process.env.SOME_NUMBER, 10, 100, 50)

Install

npm i @everymundo/number-utils

or with bun

bun i @everymundo/number-utils