Buckets:
| /* | |
| * Copyright 2020 Adobe. All rights reserved. | |
| * This file is licensed to you under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. You may obtain a copy | |
| * of the License at http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software distributed under | |
| * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | |
| * OF ANY KIND, either express or implied. See the License for the specific language | |
| * governing permissions and limitations under the License. | |
| */ /** | |
| * Takes a value and forces it to the closest min/max if it's outside. Also forces it to the closest valid step. | |
| */ function $9446cca9a3875146$export$7d15b64cf5a3a4c4(value, min = -Infinity, max = Infinity) { | |
| let newValue = Math.min(Math.max(value, min), max); | |
| return newValue; | |
| } | |
| function $9446cca9a3875146$export$e1a7b8e69ef6c52f(value, step) { | |
| let roundedValue = value; | |
| let stepString = step.toString(); | |
| let pointIndex = stepString.indexOf('.'); | |
| let precision = pointIndex >= 0 ? stepString.length - pointIndex : 0; | |
| if (precision > 0) { | |
| let pow = Math.pow(10, precision); | |
| roundedValue = Math.round(roundedValue * pow) / pow; | |
| } | |
| return roundedValue; | |
| } | |
| function $9446cca9a3875146$export$cb6e0bb50bc19463(value, min, max, step) { | |
| min = Number(min); | |
| max = Number(max); | |
| let remainder = (value - (isNaN(min) ? 0 : min)) % step; | |
| let snappedValue = $9446cca9a3875146$export$e1a7b8e69ef6c52f(Math.abs(remainder) * 2 >= step ? value + Math.sign(remainder) * (step - Math.abs(remainder)) : value - remainder, step); | |
| if (!isNaN(min)) { | |
| if (snappedValue < min) snappedValue = min; | |
| else if (!isNaN(max) && snappedValue > max) snappedValue = min + Math.floor($9446cca9a3875146$export$e1a7b8e69ef6c52f((max - min) / step, step)) * step; | |
| } else if (!isNaN(max) && snappedValue > max) snappedValue = Math.floor($9446cca9a3875146$export$e1a7b8e69ef6c52f(max / step, step)) * step; | |
| // correct floating point behavior by rounding to step precision | |
| snappedValue = $9446cca9a3875146$export$e1a7b8e69ef6c52f(snappedValue, step); | |
| return snappedValue; | |
| } | |
| function $9446cca9a3875146$export$b6268554fba451f(value, digits, base = 10) { | |
| const pow = Math.pow(base, digits); | |
| return Math.round(value * pow) / pow; | |
| } | |
| export {$9446cca9a3875146$export$7d15b64cf5a3a4c4 as clamp, $9446cca9a3875146$export$e1a7b8e69ef6c52f as roundToStepPrecision, $9446cca9a3875146$export$cb6e0bb50bc19463 as snapValueToStep, $9446cca9a3875146$export$b6268554fba451f as toFixedNumber}; | |
| //# sourceMappingURL=number.module.js.map | |
Xet Storage Details
- Size:
- 2.71 kB
- Xet hash:
- 06994ff2a384bef66db9ae69ee5bfcc01c64e62df0d43308448e151d01b62a5a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.