mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-05 20:36:26 +02:00
* license: update headers to IBM Corp. * `make proto` * update offset because source file changed Signed-off-by: Ryan Cragun <me@ryan.ec> Co-authored-by: Ryan Cragun <me@ryan.ec>
15 lines
297 B
JavaScript
15 lines
297 B
JavaScript
/**
|
|
* Copyright IBM Corp. 2016, 2025
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
export default function (num, min, max) {
|
|
let inRangeNumber;
|
|
if (typeof num !== 'number') {
|
|
inRangeNumber = min;
|
|
} else {
|
|
inRangeNumber = num;
|
|
}
|
|
return Math.min(Math.max(inRangeNumber, min), max);
|
|
}
|