From d422425be4cdbc4248817cc2c1d1787f1d431718 Mon Sep 17 00:00:00 2001 From: Kevin Van Der Werff Date: Mon, 21 Oct 2019 23:37:02 +0200 Subject: [PATCH] :art: replace R.map(R.prop) by R.pluck (equivalent). refactor state.tags & state.resources --- store/data.js | 5 ++--- utils/pure.js | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/store/data.js b/store/data.js index 48610a9..a103289 100644 --- a/store/data.js +++ b/store/data.js @@ -21,13 +21,12 @@ export const state = () => ({ } }), })), - // List of all tags, duplicates removed tags: getAllTags(resources), }) export const getters = { - tags: state => state.tags, - resources: state => state.resources, + tags: R.prop('tags'), + resources: R.prop('resources'), findCategory: state => categoryTitle => { // equalsCategoryTitle :: Category -> Bool const equalsCategoryTitle = R.compose( diff --git a/utils/pure.js b/utils/pure.js index 997fbe2..902e791 100644 --- a/utils/pure.js +++ b/utils/pure.js @@ -22,13 +22,13 @@ const Category = { export const isNotEmpty = R.compose(R.not, R.isEmpty) // getAllResources :: [Category] -> [Resource] -export const getAllResources = R.compose(R.flatten, R.map(R.prop('resources'))) +export const getAllResources = R.compose(R.flatten, R.pluck('resources')) // getAllTags :: [Category] -> [String] export const getAllTags = R.compose( R.uniq, R.flatten, - R.map(R.prop('tags')), + R.pluck('tags'), getAllResources )