Skip to content

Commit 9ee3e75

Browse files
committed
Gets a value from an object with a min / max clamp.
1 parent c8d22fe commit 9ee3e75

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var GetObjectValue = require('./GetObjectValue');
2+
var Clamp = require('../../math/Clamp');
3+
4+
var GetMinMaxValue = function (source, key, min, max, defaultValue)
5+
{
6+
if (defaultValue === undefined) { defaultValue = min; }
7+
8+
var value = GetObjectValue(source, key, defaultValue);
9+
10+
return Clamp(value, min, max);
11+
};
12+
13+
module.exports = GetMinMaxValue;

0 commit comments

Comments
 (0)