constrain-number

1.0.0 • Public • Published

constrain-number

Constrain a number.

usage

import { min, max, constrain } from "number-limits"

const min10 = min(10)
const max100 = max(100)
const limiter = constrain({ min: 10, max: 100 })

min10(1) // 10
max100(110) // 100
limiter(1) // 10
limiter(110) // 100

Package Sidebar

Install

npm i constrain-number

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • rogerbf