This repository has been archived by the owner on Aug 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
querystring mutations and parser (#95)
- Loading branch information
1 parent
8e84910
commit 3ae623d
Showing
8 changed files
with
71 additions
and
38 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
import { toArray } from '../utilities' | ||
|
||
export default { | ||
activeFacetChoices (state) { | ||
return state.facetChoices.filter(choice => choice.active) | ||
}, | ||
|
||
activeFacets (state, getters) { | ||
return getters.activeFacetChoices | ||
.reduce((acc, cur) => { | ||
if (acc[cur.facet]) { | ||
if (!Array.isArray(acc[cur.facet])) { | ||
acc[cur.facet] = toArray(acc[cur.facet]) | ||
} | ||
acc[cur.facet].push(cur.value) | ||
} | ||
else acc[cur.facet] = cur.value | ||
return acc | ||
}, {}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const toArray = value => Array.isArray(value) ? value : value ? [value] : undefined |