GT2/GT2-Android/node_modules/react-native/Libraries/Utilities/clamp.js

31 lines
625 B
JavaScript
Raw Normal View History

/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule clamp
* @typechecks
*/
'use strict';
/**
* @param {number} min
* @param {number} value
* @param {number} max
* @return {number}
*/
function clamp(min, value, max) {
if (value < min) {
return min;
}
if (value > max) {
return max;
}
return value;
}
module.exports = clamp;