{"size": 591, "ext": "js", "max_stars_repo_path": "src/redux/spells/selectors.js", "max_stars_repo_name": "carvallegro/rebrew", "max_stars_repo_stars_event_min_datetime": "2020-01-16T02:48:49.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-11T12:48:52.000Z", "max_issues_repo_path": "src/redux/spells/selectors.js", "max_issues_repo_name": "carvallegro/rebrew", "max_issues_repo_issues_event_min_datetime": "2020-01-15T22:14:02.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T21:17:02.000Z", "max_forks_repo_path": "src/redux/spells/selectors.js", "max_forks_repo_name": "carvallegro/rebrew", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": 31, "max_forks_count": null, "avg_line_length": 25.6956521739, "max_line_length": 68, "alphanum_fraction": 0.7461928934}
import * as R from 'ramda'
import { createSelector } from '@reduxjs/toolkit'

const selectAllSpellsIndexedByName = R.pathOr([], ['spells'])

export const selectAllSpells = createSelector(
  selectAllSpellsIndexedByName,
  Object.values
)

export const selectAllSpellsWithoutSrd = createSelector(
  selectAllSpells,
  R.pipe(R.reject(R.propEq('srd', true)), R.indexBy(R.prop('name')))
)

export const selectAllSpellNames = createSelector(
  selectAllSpellsIndexedByName,
  Object.keys
)

export const selectSpellByName = (state, { spellName }) =>
  R.pathOr([], ['spells', spellName], state)
