From 3d1a1383e83b438dc3ffe0e3187fa2b36828d330 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 13 Apr 2024 15:42:14 -0300 Subject: validators: isDimensions: accept null width and/or height --- src/data/validators.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/data') diff --git a/src/data/validators.js b/src/data/validators.js index 46dd292d..987f806d 100644 --- a/src/data/validators.js +++ b/src/data/validators.js @@ -643,10 +643,15 @@ export function isDimensions(dimensions) { if (dimensions.length !== 2) throw new TypeError(`Expected 2 item array`); - isPositive(dimensions[0]); - isInteger(dimensions[0]); - isPositive(dimensions[1]); - isInteger(dimensions[1]); + if (dimensions[0] !== null) { + isPositive(dimensions[0]); + isInteger(dimensions[0]); + } + + if (dimensions[1] !== null) { + isPositive(dimensions[1]); + isInteger(dimensions[1]); + } return true; } -- cgit 1.3.0-6-gf8a5