Skip to content

Commit

Permalink
feat: getRelativePeriodsMap
Browse files Browse the repository at this point in the history
  • Loading branch information
BRaimbault committed Nov 25, 2024
1 parent 433b1c5 commit a307042
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/components/PeriodDimension/utils/relativePeriods.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,12 @@ export const getRelativePeriodIds = () =>
Object.values(getOptions())
.map((option) => option.getPeriods().map((period) => period.id))
.flat()

export const getRelativePeriodsMap = () =>
Object.values(getOptions())
.map((option) => option.getPeriods())
.flat()
.reduce((acc, period) => {
acc[period.id] = period.name
return acc
}, {})
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export {
} from './components/PeriodDimension/utils/index.js'
export {
getRelativePeriodsOptionsById,
getRelativePeriodIds,
getRelativePeriodsMap,
} from './components/PeriodDimension/utils/relativePeriods.js'
export { getFixedPeriodsOptionsById } from './components/PeriodDimension/utils/fixedPeriods.js'

Expand Down

0 comments on commit a307042

Please sign in to comment.