diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-05-12 19:01:23 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-05-12 19:01:23 -0300 |
commit | a453db3ee0152ecf3c70dce5fae516b80a9eb014 (patch) | |
tree | 8487230190cf883d1306fba2a3a77295cec0c4c0 /src/data/validators.js | |
parent | 0b9c1c230594d80b92f3d0d2dda380ff8de7a1a0 (diff) |
always show "expected array" during validation
...instead of "expected object" if the value isn't an object.
Diffstat (limited to 'src/data/validators.js')
-rw-r--r-- | src/data/validators.js | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/data/validators.js b/src/data/validators.js index 2d90987f..1ac8c336 100644 --- a/src/data/validators.js +++ b/src/data/validators.js @@ -129,9 +129,7 @@ export function isObject(value) { } export function isArray(value) { - isObject(value); - - if (!Array.isArray(value)) + if (typeof value !== 'object' || value === null || !Array.isArray(value)) throw new TypeError(`Expected an array, got ${value}`); return true; |