From 6525d472cd9d71b1b8f2407a7b42a4e51fce77e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Mon, 4 Jul 2016 22:43:14 +0800 Subject: [PATCH] Added clamp function --- math.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 math.js diff --git a/math.js b/math.js new file mode 100644 index 0000000..8e35b34 --- /dev/null +++ b/math.js @@ -0,0 +1,3 @@ +module.exports = { + clamp: ( v, min, max ) => Math.max( min, Math.min( v, max ) ) +};