import { copy } from 'copy-anything' ; import { merge } from 'merge-anything' ; import { PokedexEntry , allPokemonArray } from './pokemon' ; export { PokedexEntry , PokemonType } from './pokemon' ; export function pokedexEntryDefaults ( values ) { const defaults = { id : 0 , name : '' , type : [ ] , base : { HP : 0 , Attack : 0 , Defense : 0 , SpAttack : 0 , SpDefense : 0 , Speed : 0 , } , } ; return merge ( defaults , values ) ; } export function pokedex ( pokedexNr ) { const entryIndex = pokedexNr - 1 ; return copy ( allPokemonArray [ entryIndex ] ) ; } export function pokedexGetAll ( ) { return copy ( allPokemonArray ) ; } export function pokedexMap ( ) { const entries = copy ( allPokemonArray ) . map ( ( p ) => [ String ( p . id ) , p ] ) ; return new Map ( entries ) ; }