Skip to content

Commit

Permalink
Change _.uniq to only be called once
Browse files Browse the repository at this point in the history
  • Loading branch information
Kainic authored and Kainic committed Jul 13, 2018
1 parent 2b5f1a9 commit 086676b
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 086676b

Please sign in to comment.