Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
WrappedComponent: React.ComponentType,
computeExtraProps?: (cards: Results) => ExtraProps
): React.ComponentType {
interface ReduxProps {
tabooSetId?: number;
}
const mapStateToProps = (
state: AppState,
props: Props & TabooSetOverride
): ReduxProps => {
return {
tabooSetId: getTabooSet(state, props.tabooSetOverride),
};
};
const result = connect(mapStateToProps)(
connectRealm(
WrappedComponent, {
schemas: ['Card', 'TabooSet'],
mapToProps(
results: CardAndTabooSetResults,
realm: Realm,
props: Props & ReduxProps
): PlayerCardProps & ExtraProps {
const playerCards = results.cards.filtered(
`((type_code == "investigator" AND encounter_code == null) OR deck_limit > 0 OR bonded_name != null) and ${Card.tabooSetQuery(props.tabooSetId)}`
);
const investigators: CardsMap = {};
const cards: CardsMap = {};
forEach(
playerCards,
card => {
cards[card.code] = card;
export default function withWeaknessCards(
WrappedComponent: React.ComponentType
): React.ComponentType {
interface ReduxProps {
tabooSetId?: number;
}
const mapStateToProps = (state: AppState): ReduxProps => {
return {
tabooSetId: getTabooSet(state),
};
};
const result = connect(mapStateToProps)(
connectRealm(
WrappedComponent, {
schemas: ['Card'],
mapToProps(
results: CardResults,
realm: Realm,
props: Props & ReduxProps
): WeaknessCardProps {
const cards = results.cards
.filtered(`${BASIC_WEAKNESS_QUERY} and ${Card.tabooSetQuery(props.tabooSetId)}`)
.sorted([['name', false]]);
const cardsMap: CardsMap = {};
forEach(cards, card => {
cardsMap[card.code] = card;
});
return {
cards,