From a453db3ee0152ecf3c70dce5fae516b80a9eb014 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 12 May 2022 19:01:23 -0300 Subject: always show "expected array" during validation ...instead of "expected object" if the value isn't an object. --- src/data/validators.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/data/validators.js b/src/data/validators.js index 2d90987..1ac8c33 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; -- cgit 1.3.0-6-gf8a5