diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-04-13 15:42:14 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-04-13 15:47:35 -0300 |
commit | 3d1a1383e83b438dc3ffe0e3187fa2b36828d330 (patch) | |
tree | fd7d82d64fdcc65ce60dac3a87ebd5f200bd1cbd /src | |
parent | fb6e7816d1911e9e2b218939d2b5c7eef22ab552 (diff) |
validators: isDimensions: accept null width and/or height
Diffstat (limited to 'src')
-rw-r--r-- | src/data/validators.js | 13 |
1 files changed, 9 insertions, 4 deletions
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; } |