You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
446 B
20 lines
446 B
import _ from 'lodash';
|
|
import { createSelector } from 'reselect';
|
|
import createAllMoviesSelector from './createAllMoviesSelector';
|
|
|
|
function createProfileInUseSelector(profileProp) {
|
|
return createSelector(
|
|
(state, { id }) => id,
|
|
createAllMoviesSelector(),
|
|
(id, movies) => {
|
|
if (!id) {
|
|
return false;
|
|
}
|
|
|
|
return _.some(movies, { [profileProp]: id });
|
|
}
|
|
);
|
|
}
|
|
|
|
export default createProfileInUseSelector;
|