Created utils functions within Pokedex
This commit is contained in:
parent
fed47e34b0
commit
40358e3900
11
src/features/Pokedex/utils.ts
Normal file
11
src/features/Pokedex/utils.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { RegionPokemonRange } from './types/slice';
|
||||
|
||||
export const getStartAndEndIdsForRegion = (
|
||||
region: string,
|
||||
data: RegionPokemonRange[],
|
||||
): { startId: number; endId: number } => {
|
||||
const regionData = data.find(data => data.region === region);
|
||||
return regionData
|
||||
? { startId: regionData.startId, endId: regionData.endId }
|
||||
: { startId: 0, endId: 0 };
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user