Created utils functions within Pokedex

develop
Jason Zhu 2023-04-05 21:37:03 +10:00
parent fed47e34b0
commit 40358e3900
1 changed files with 11 additions and 0 deletions

View 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 };
};