import { categories } from './categories' ; /**
 * A list of character width for specific categories.
 */ const characterWidth = { Creatures : 120 , Villagers : 120 } ; param filename return function find ( filename ) { for ( const key in categories ) { if ( categories [ key as keyof typeof categories ] . includes ( filename ) ) return key ; } return undefined ; } param key return export function width ( key ) { if ( categories . hasOwnProperty ( key ) ) { return characterWidth [ key ] ; } const category = find ( key . split ( '.' ) [ 0 ] ) ; return category ? characterWidth [ category ] : undefined ; }