From a2fae1e5d7d224a2d886d49bcccc40b8d9c599cc Mon Sep 17 00:00:00 2001 From: Athanasios <ath.kouk.oid@gmail.com> Date: Sun, 25 Jul 2021 21:46:01 +0200 Subject: [PATCH] add toUpper and bounding box sanitizer --- src/customSanitizers.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/customSanitizers.js b/src/customSanitizers.js index 42ccd80..39a8b36 100644 --- a/src/customSanitizers.js +++ b/src/customSanitizers.js @@ -1,6 +1,21 @@ const toLower = (value) => { - if(!value) return; + if (!value) return; return value.toLowerCase(); } -module.exports = { toLower }; \ No newline at end of file +const toUpper = (value) => { + if (!value) return; + return value.toUpperCase(); +} + +const boundingboxIsValid = (value) => { + let tokens = value.split(","); + tokens = tokens.map(token => parseFloat(token)); + if (tokens[0] < tokens[2] && tokens[1] < tokens[3]) { + return true; + } + return false; + +} + +module.exports = { toLower, toUpper, boundingboxIsValid }; \ No newline at end of file -- GitLab