Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'kanjiSvgDrawSpeed',
])
)
);
export const selectUsername = createSelector(selectUserProfile, getBy('name'));
export const selectApiKey = createSelector(selectUserProfile, getBy('apiKey'));
export const selectUserLevel = createSelector(selectUserProfile, getBy('level', Number));
export const selectOnVacation = createSelector(selectUserProfile, getBy('onVacation', Boolean));
export const selectVacationDate = createSelector(
selectUserProfile,
getBy('vacationDate', dateOrFalse)
);
export const selectNextReviewDate = createSelector(
selectUserProfile,
// padded with 30 second safety net to ensure server is completely updated when we request new review count
getBy('nextReviewDate', (date) => (date != null ? addSeconds(date, 30) : false))
);
export const selectFreshUser = createSelector(
[
selectNextReviewDate,
selectLessonsCount,
selectReviewsCount,
getBy(['entities', 'reviews'], (x = {}) => Object.keys(x).length),
],
(nextReviewDate, lessonsCount, reviewsCount, reviewEntitiesCount) => !nextReviewDate && lessonsCount && !reviewsCount && !reviewEntitiesCount
);
export const selectLastWkSyncDate = createSelector(
const makeSelectLocale = () =>
createSelector(selectLanguage, languageState => languageState.get('locale'));
toggleDropdown (event) {
const shiftKey = event.nativeEvent && event.nativeEvent.shiftKey
this.setState({
showDropdown: !this.state.showDropdown,
shiftKey
})
}
}
function mapDispatchToProps (dispatch) {
return {
logOut: () => dispatch(logOut())
}
}
export default connect(createSelector(
selectLoading(),
selectOAuth(),
selectSubmissions(),
(loading, oauth, submissions) => ({
loading, oauth, submissions
})
), mapDispatchToProps)(Menu)
});
export const getStdDev = createSelector(
[getMeans, getData],
(data, rawData) => {
if (!data) return null;
return getStdDevData(data, rawData);
}
);
export const getDates = createSelector([getStdDev], data => {
if (!data) return null;
return getDatesData(data);
});
export const parseData = createSelector([getDates, getWeeks], (data, weeks) => {
if (!data) return null;
return data.slice(-weeks);
});
export const parseConfig = createSelector([getColors], colors =>
getChartConfig(
colors,
moment()
.subtract(2, 'w')
.format('YYYY-MM-DD')
)
);
export const parseSentence = createSelector(
[parseData, getColors, getActiveData, getSentences, getDataset],
(data, colors, activeData, sentence, dataset) => {
export const getReviewsTotalCount = createSelector(
getCollectionForCurrentBaseProduct,
(collection) => {
if (!collection || !collection.hasOwnProperty('totalReviewCount')) {
return null;
}
return collection.totalReviewCount;
}
);
/**
* Retrieves the total number of currently fetched reviews for a current product.
* @param {Object} state The current application state.
* @return {number|null} The current number of fetched reviews.
*/
export const getCurrentReviewCount = createSelector(
getCollectionForCurrentBaseProduct,
(collection) => {
if (!collection || !collection.reviews) {
return null;
}
return collection.reviews.length;
}
);
/**
* Retrieves the information if reviews are currently fetched.
* @param {Object} state The current application state.
* @return {bool} The boolean information if reviews are currently being fetched.
*/
export const getReviewsFetchingState = createSelector(
return newFieldMap;
})
.case(updateFieldProperties, (fields, { fieldName, fieldProperties }) => {
return { ...fields, [fieldName]: { ...fields[fieldName], ...fieldProperties } };
})
.case(selectField, (fields, fieldName) => {
return { ...fields, [fieldName]: { ...fields[fieldName], selected: true } };
})
.case(deselectField, (fields, fieldName) => {
return { ...fields, [fieldName]: { ...fields[fieldName], selected: false } };
})
.build();
export const fieldMapSelector = (state: GraphState) => state.fields;
export const fieldsSelector = createSelector(
fieldMapSelector,
fields => Object.values(fields)
);
export const selectedFieldsSelector = createSelector(
fieldsSelector,
fields => fields.filter(field => field.selected)
);
export const liveResponseFieldsSelector = createSelector(
selectedFieldsSelector,
fields => fields.filter(field => field.hopSize && field.hopSize > 0)
);
export const hasFieldsSelector = createSelector(
selectedFieldsSelector,
fields => fields.length > 0
);
import { createSelector } from 'reselect';
const getCollections = state => state.user.collections.items;
const getTab = state => state.routes.query.tab;
const parseTabCollections = (collections, tab) =>
collections.map(collection => ({
id: collection.id,
label: collection.attributes.name,
value: collection.id,
route: 'myrw',
params: { tab, subtab: collection.id }
}));
export const getParsedCollections = createSelector([getCollections, getTab], parseTabCollections);
export default { getParsedCollections };
import { createSelector } from 'reselect';
import { AppState } from '../reducers';
export const getMemoizedConfiguration = createSelector([(state: AppState) => state.configuration], configuration => {
return configuration;
});
const canOfferBeCancelled = createSelector(
(rootState, offerId) => {
if (offerId) {
const foundOffer = findOffer(offerId, rootState);
if (foundOffer && foundOffer.offer && foundOffer.offer.status !== OFFER_STATUS_INACTIVE) {
return foundOffer.offer.owner.toString() === accounts.defaultAccount(rootState).toString();
} else {
return false;
}
}
},
canCancel => Boolean(canCancel)
);
const reSyncOffersSet = createSelector(
offers,
s => s.get('reSyncOffersSet')
);
export default {
state: offers,
offersInitialized,
loadingBuyOffers,
loadingSellOffers,
activeTradingPairBuyOffers,
activeTradingPairSellOffers,
activeTradingPairBuyOfferCount,
activeTradingPairSellOfferCount,
activeTradingPairOffersInitialLoadPending,
activeTradingPairOffersInitiallyLoaded,
activeTradingPairOffersInitialLoadStatus,
import { createSelector } from 'reselect';
import _ from 'lodash/fp';
const sidebarVisibilitySelector = ({ isSidebarVisible }) => isSidebarVisible;
const userAccountSelector = ({ userAccount }) => userAccount;
const sidebarAndUserSelector = createSelector(
sidebarVisibilitySelector,
userAccountSelector,
(isSidebarVisible, userAccount) => ({ isSidebarVisible, userAccount })
);
const mainSelector = createSelector(
({ patientsSummaries }) => patientsSummaries,
(state, props) => _.getOr(null, 'match.params.userId', props),
(patientSummeriesParams) => {
return ({ patientSummeriesParams })
}
);
export { sidebarAndUserSelector, mainSelector };