From 086676b77d7ee73021b1194e475e7f58471f62ad Mon Sep 17 00:00:00 2001 From: Kainic Date: Fri, 13 Jul 2018 15:39:56 -0400 Subject: [PATCH] Change _.uniq to only be called once --- src/js/helpers.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/js/helpers.js b/src/js/helpers.js index eb6a7a5..c6382d5 100644 --- a/src/js/helpers.js +++ b/src/js/helpers.js @@ -25,19 +25,13 @@ export function getActivePages(pages, data) { } export function getActiveProperties(activePages) { - let allProperties = []; - activePages.map(page => { + const allProperties = []; + activePages.forEach(page => { if (page.schema) { - allProperties = _.uniq(_.concat(Object.keys(page.schema.properties), allProperties)); + allProperties.push(...Object.keys(page.schema.properties)); } - return allProperties; }); - - return allProperties; - - // return new Set([].concat( - // ...activePages.map(page => Object.keys(page.schema.properties)) - // )); + return _.uniq(allProperties); } export function getInactivePages(pages, data) {