Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo-mod-jslibs-dist.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'popperjs/package/lib/utils/within.js.flow')
-rw-r--r--popperjs/package/lib/utils/within.js.flow11
1 files changed, 11 insertions, 0 deletions
diff --git a/popperjs/package/lib/utils/within.js.flow b/popperjs/package/lib/utils/within.js.flow
new file mode 100644
index 0000000..bc946f2
--- /dev/null
+++ b/popperjs/package/lib/utils/within.js.flow
@@ -0,0 +1,11 @@
+// @flow
+import { max as mathMax, min as mathMin } from './math';
+
+export function within(min: number, value: number, max: number): number {
+ return mathMax(min, mathMin(value, max));
+}
+
+export function withinMaxClamp(min: number, value: number, max: number) {
+ const v = within(min, value, max);
+ return v > max ? max : v;
+}