math-clamp-x
Clamp a number to limits.
Last updated 7 years ago by xotic750 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install math-clamp-x 
SYNC missed versions from official npm registry.

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

math-clamp-x

Clamp a number to limits.

module.exports(value, [min], max)number

This method clamp a number to min and max limits inclusive.

Kind: Exported function
Returns: number - The clamped number.
Throws:

  • RangeError If min > max.
Param Type Default Description
value number The number to be clamped.
[min] number 0 The minimum number.
max number The maximum number.

Example

import mathClamp from 'math-clamp-x';

console.log(mathClamp(-5, 3, 3)); // 3
console.log(mathClamp(0, 3, 3)); // 3
console.log(mathClamp(5, 3, 3)); // 3

Current Tags

  • 3.2.2                                ...           latest (7 years ago)

31 Versions

  • 3.2.2                                ...           7 years ago
  • 3.2.1                                ...           7 years ago
  • 3.2.0                                ...           7 years ago
  • 3.1.0                                ...           7 years ago
  • 3.0.23                                ...           7 years ago
  • 3.0.22                                ...           7 years ago
  • 3.0.21                                ...           7 years ago
  • 3.0.20                                ...           7 years ago
  • 3.0.19                                ...           7 years ago
  • 3.0.18                                ...           7 years ago
  • 3.0.17                                ...           7 years ago
  • 3.0.16                                ...           7 years ago
  • 3.0.15                                ...           7 years ago
  • 3.0.14                                ...           7 years ago
  • 3.0.13                                ...           7 years ago
  • 3.0.12                                ...           7 years ago
  • 3.0.11                                ...           7 years ago
  • 3.0.10                                ...           7 years ago
  • 3.0.9                                ...           7 years ago
  • 3.0.8                                ...           7 years ago
  • 3.0.7                                ...           7 years ago
  • 3.0.6                                ...           7 years ago
  • 3.0.5                                ...           7 years ago
  • 3.0.4                                ...           7 years ago
  • 3.0.3                                ...           7 years ago
  • 3.0.2                                ...           7 years ago
  • 3.0.1                                ...           7 years ago
  • 3.0.0                                ...           7 years ago
  • 1.2.0                                ...           8 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 3
Last Day 0
Last Week 16
Last Month 15
Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |