From 50c9268942d57209b4d774e1f7f3c6ebc125fdfd Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Sat, 20 Oct 2018 04:52:08 +0200 Subject: [PATCH] creating a "is between function" --- server/src/utils/functions.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/src/utils/functions.js b/server/src/utils/functions.js index fe27e5dde..0963b4b45 100644 --- a/server/src/utils/functions.js +++ b/server/src/utils/functions.js @@ -14,3 +14,13 @@ export const slugify = (text) => { export const epoch = () => { return Math.round(new Date().getTime() / 1000) } + +export const isBetween = (value, valA, valB) => { + const min = valA < valB ? valA : valB + const max = valA > valB ? valA : valB + if (value >= min && value <= max) { + return true + } else { + return false + } +}