From d83ed1fe0e32b91303fe2ce0f88c17edb2de6bdd Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Fri, 14 Jul 2023 03:28:31 +0200 Subject: [PATCH] Remove obsolete code --- index.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/index.js b/index.js index 215d4fd..f5497af 100644 --- a/index.js +++ b/index.js @@ -73,22 +73,6 @@ function isObject(value) { return (value != null && typeof value === "object" && !Array.isArray(value)); } -// TODO: Move to separate package, decide whether to keep the nested array detection or not - that should probably just be part of the handler? -function mapMaybeArray(value, handler) { - // NOTE: This is async! - if (Array.isArray(value)) { - return Promise.map(value, (item, i) => { - if (Array.isArray(item)) { - throw new Error(`Encountered a nested array, which is not allowed; maybe you forgot to flatten it?`); - } else { - return handler(item, i); - } - }); - } else { - return handler(value); - } -} - /* Possible values of a schema property: true, null, object with only special keys (but not $recurse) -- fetch value and return it as-is false -- do not fetch value at all