Created utils functions within Pokedex
parent
fed47e34b0
commit
40358e3900
|
@ -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…
Reference in New Issue