@@ -8,21 +8,24 @@ import { CRITERIA } from "../../../../domain/types.ts";
88
99const ORDER : readonly CriteriaCode [ ] = CRITERIA ;
1010
11- const isCode = ( v : string ) : v is CriteriaCode => ( ORDER as readonly string [ ] ) . includes ( v ) ;
11+ const isCode = ( value : string ) : value is CriteriaCode =>
12+ ( ORDER as readonly string [ ] ) . includes ( value ) ;
1213
13- const normalizeCriteria = ( arr : readonly ( string | CriteriaCode ) [ ] ) : CriteriaCode [ ] =>
14- Array . from ( new Set ( arr ) )
14+ const normalizeCriteria = ( values : readonly ( string | CriteriaCode ) [ ] ) : CriteriaCode [ ] =>
15+ Array . from ( new Set ( values ) )
1516 . filter ( isCode )
1617 . sort ( ( a , b ) => ORDER . indexOf ( a ) - ORDER . indexOf ( b ) ) ;
1718
18- const fmtHa = ( v : number | null ) => ( v == null ? "—" : `${ Number ( v ) . toLocaleString ( "en-CA" ) } ha` ) ;
19+ const fmtHa = ( value : number | null ) : string =>
20+ value == null ? "—" : `${ Number ( value ) . toLocaleString ( "en-CA" ) } ha` ;
1921
20- const titleOf = ( data : ApiWorldHeritageDto ) =>
22+ const titleOf = ( data : ApiWorldHeritageDto ) : string =>
2123 data . heritage_name_jp || data . official_name || data . name ;
2224
23- const countryLabelOf = ( data : ApiWorldHeritageDto ) => data . country_name_jp || data . country || null ;
25+ const countryLabelOf = ( data : ApiWorldHeritageDto ) : string | null =>
26+ data . country_name_jp || data . country || null ;
2427
25- const subtitleOf = ( data : ApiWorldHeritageDto ) =>
28+ const subtitleOf = ( data : ApiWorldHeritageDto ) : string =>
2629 [ countryLabelOf ( data ) , data . region ] . filter ( Boolean ) . join ( " · " ) ;
2730
2831const toStatePartyLabelsJp = ( codes : readonly string [ ] ) : string [ ] =>
@@ -31,14 +34,16 @@ const toStatePartyLabelsJp = (codes: readonly string[]): string[] =>
3134const normalizeStatePartiesMeta = (
3235 meta : ApiWorldHeritageDto [ "state_parties_meta" ] ,
3336) : WorldHeritageVm [ "statePartiesMeta" ] => {
34- if ( Array . isArray ( meta ) ) return { } ;
37+ if ( Array . isArray ( meta ) ) {
38+ return { } ;
39+ }
3540
3641 return Object . fromEntries (
37- Object . entries ( meta ) . map ( ( [ k , v ] ) => [
38- k ,
42+ Object . entries ( meta ) . map ( ( [ key , value ] ) => [
43+ key ,
3944 {
40- isPrimary : v . is_primary ,
41- inscriptionYear : v . inscription_year ,
45+ isPrimary : value . is_primary ,
46+ inscriptionYear : value . inscription_year ,
4247 } ,
4348 ] ) ,
4449 ) ;
0 commit comments