mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
23 lines
580 B
JavaScript
23 lines
580 B
JavaScript
// @flow
|
|
import { createSelector } from 'reselect';
|
|
import { getItemById } from 'store/selectors';
|
|
|
|
const currenciesItemsSelector = (state) => state.currencies.data;
|
|
const currenciesCodePropSelector = (state, props) => props.currencyId;
|
|
|
|
export const getCurrenciesList = createSelector(
|
|
currenciesItemsSelector,
|
|
(currencies) => {
|
|
return Object.values(currencies);
|
|
},
|
|
);
|
|
|
|
export const getCurrencyByCode = createSelector(
|
|
currenciesItemsSelector,
|
|
currenciesCodePropSelector,
|
|
(currencies, currencyCode) => {
|
|
return getItemById(currencies, currencyCode);
|
|
},
|
|
);
|
|
|