From 9657179c1d505d14d6af00a27e19490f73b0b04c Mon Sep 17 00:00:00 2001 From: Lukas Siemon Date: Fri, 15 Jan 2021 11:41:19 -0800 Subject: [PATCH] amend: simplification Untested, but this should work exactly the same --- src/vue-app/scanners/category.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/vue-app/scanners/category.js b/src/vue-app/scanners/category.js index daf0e4e..ec10b13 100644 --- a/src/vue-app/scanners/category.js +++ b/src/vue-app/scanners/category.js @@ -1,19 +1,8 @@ import objectScan from "object-scan"; -const getAllCategories = async (input) => { - let results = []; - - objectScan(["**.type"], { - filterFn: ({ value, parent }) => { - const isCategoryNode = value === "category"; - - if (isCategoryNode) { - results.push(parent); - } - } - })(input); - - return results; -}; +const getAllCategories = async (input) => objectScan(["**.type"], { + rtn: 'parent', + filterFn: ({ value }) => value === "category" +})(input); export default getAllCategories;