creating a "is between function"

This commit is contained in:
Nikola Bjelo committed 2018-10-20 04:52:08 +02:00
1 parent 234f220c74
commit 50c9268942
1 file changed
+10
+10
View File
@@ -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
}
}