Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function mapStateToProps(state: AppState) {
return {
currentUser: state.currentUser,
profileNew: state.profileNew,
profile: denormalize(state.profileNew.profileId, profileSchema, state.entities),
};
}
(id: ?ProductId, entities: EntitiesState): ?Product => denormalize(id, productSchema, entities),
)
public getFlatTree(treeDefinition: IRecursiveDelete, state: Partial): IFlatTree {
const { schema, guid } = treeDefinition;
const denormed = denormalize(guid, schema, state);
this.entityExcludes = this.excludes[schema.key] || [];
return this.build(schema, denormed, undefined, true);
}
export const getMemoizedPaper = createSelector([getPaperId, getPaperEntities], (paperId, paperEntities) => {
const paper: Paper | null = denormalize(paperId, paperSchema, { papers: paperEntities });
return paper;
});
const mapStateToProps = (state, props) => {
const { auth, entities, objects, player: { playingTrack }, app, player, ui } = state
const { object_id, object_type, location, history } = props
const playlist_objects = objects[object_type] || {}
const playlist_object = playlist_objects[object_id]
let denormalized = []
if (playlist_object) {
denormalized = denormalize(playlist_object.items, new schema.Array({
playlists: playlistSchema,
tracks: trackSchema
}, (input) => `${input.kind}s`), entities)
}
return {
entities,
auth,
playingTrack,
app,
player,
playlist_object,
items: denormalized,
scrollTop: history.action === 'POP' ? ui.scrollPosition[location.pathname] : undefined
}
}
(entities, playingSongId) => (playingSongId !== null
? denormalize(playingSongId, songSchema, entities)
: null
),
);
challenges = _map(this.challengeProjects(projectId, this.props), challenge =>
denormalize(challenge, challengeDenormalizationSchema(), this.props.entities)
)
return (newsId: number) => {
let commentIds = state.map[newsId];
if (!commentIds) {
return [];
}
return denormalize(commentIds, [commentSchema], rootState.entities);
}
}
entities =>
denormalize({customers: id}, {customers: customerSchema}, entities).customers
)(state),
(entities: EntitiesState): Array => {
const ids = entities.subscriptions != null ? Object.keys(entities.subscriptions) : []
return denormalize(ids, subscriptionsSchema, entities)
},
)