@@ -46,12 +46,13 @@ export function mapRubygemsOwners(
4646 const contacts : RawContact [ ] = [ ]
4747 const seen = new Set < string > ( )
4848 for ( const owner of owners ) {
49- const email = owner && typeof owner === 'object' ? ( owner as any ) . email : undefined
49+ const o = ( owner ?? { } ) as Record < string , unknown >
50+ const email = o . email
5051 if ( typeof email !== 'string' || ! isEmail ( email ) ) continue
5152 const key = email . toLowerCase ( )
5253 if ( seen . has ( key ) ) continue
5354 seen . add ( key )
54- const handle = typeof ( owner as any ) . handle === 'string' ? ( owner as any ) . handle : undefined
55+ const handle = typeof o . handle === 'string' ? o . handle : undefined
5556 contacts . push ( {
5657 channel : 'email' ,
5758 value : email ,
@@ -83,14 +84,10 @@ export async function fetchRubygems(
8384
8485 if ( ! gemResult . json ) return { contacts : [ ] , policies : { } }
8586
86- const contacts = mapRubygems ( gemResult . json , gemUrl , fetchedAt )
87- const seen = new Set ( contacts . map ( ( c ) => c . value . toLowerCase ( ) ) )
88- for ( const ownerContact of mapRubygemsOwners ( ownersResult . json , ownersUrl , fetchedAt ) ) {
89- const key = ownerContact . value . toLowerCase ( )
90- if ( seen . has ( key ) ) continue
91- seen . add ( key )
92- contacts . push ( ownerContact )
93- }
87+ const contacts = [
88+ ...mapRubygems ( gemResult . json , gemUrl , fetchedAt ) ,
89+ ...mapRubygemsOwners ( ownersResult . json , ownersUrl , fetchedAt ) ,
90+ ]
9491
9592 return { contacts, policies : { } }
9693}
0 commit comments