11import * as Browser from "./types" ;
2- import { mapToArray , distinct , map , toNameMap , mapDefined , arrayToMap , flatMap , integerTypes , baseTypeConversionMap } from "./helpers" ;
2+ import { mapToArray , distinct , map , toNameMap , mapDefined , arrayToMap , integerTypes , baseTypeConversionMap } from "./helpers" ;
33import { collectLegacyNamespaceTypes } from "./legacy-namespace" ;
44
55export const enum Flavor {
@@ -131,14 +131,14 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor, iterator: boo
131131 getElements ( webidl . mixins , "mixin" ) ) ;
132132
133133 const allInterfacesMap = toNameMap ( allInterfaces ) ;
134- const allLegacyWindowAliases = flatMap ( allInterfaces , i => i [ "legacy-window-alias" ] ) ;
134+ const allLegacyWindowAliases = allInterfaces . flatMap ( i => i [ "legacy-window-alias" ] ) ;
135135 const allDictionariesMap = webidl . dictionaries ? webidl . dictionaries . dictionary : { } ;
136136 const allEnumsMap = webidl . enums ? webidl . enums . enum : { } ;
137137 const allCallbackFunctionsMap = webidl [ "callback-functions" ] ? webidl [ "callback-functions" ] ! [ "callback-function" ] : { } ;
138138 const allTypeDefsMap = new Set ( webidl . typedefs && webidl . typedefs . typedef . map ( td => td [ "new-type" ] ) ) ;
139139
140140 /// Event name to event type map
141- const eNameToEType = arrayToMap ( flatMap ( allNonCallbackInterfaces , i => i . events ? i . events . event : [ ] ) , e => e . name , e => eventTypeMap [ e . name ] || e . type ) ;
141+ const eNameToEType = arrayToMap ( allNonCallbackInterfaces . flatMap ( i => i . events ? i . events . event : [ ] ) , e => e . name , e => eventTypeMap [ e . name ] || e . type ) ;
142142
143143 /// Tag name to element name map
144144 const tagNameToEleName = getTagNameToElementNameMap ( ) ;
@@ -149,7 +149,7 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor, iterator: boo
149149
150150 /// Distinct event type list, used in the "createEvent" function
151151 const distinctETypeList = distinct (
152- flatMap ( allNonCallbackInterfaces , i => i . events ? i . events . event . map ( e => e . type ) : [ ] )
152+ allNonCallbackInterfaces . flatMap ( i => i . events ? i . events . event . map ( e => e . type ) : [ ] )
153153 . concat ( allNonCallbackInterfaces . filter ( i => i . extends && i . extends . endsWith ( "Event" ) && i . name . endsWith ( "Event" ) ) . map ( i => i . name ) )
154154 ) . sort ( ) ;
155155
@@ -235,7 +235,7 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor, iterator: boo
235235
236236 const iExtends = i . extends && i . extends . replace ( / < .* > $ / , '' ) ;
237237 const parentWithEventHandler = allInterfacesMap [ iExtends ] && getParentEventHandler ( allInterfacesMap [ iExtends ] ) || [ ] ;
238- const mixinsWithEventHandler = flatMap ( i . implements || [ ] , i => getParentEventHandler ( allInterfacesMap [ i ] ) ) ;
238+ const mixinsWithEventHandler = ( i . implements || [ ] ) . flatMap ( i => getParentEventHandler ( allInterfacesMap [ i ] ) ) ;
239239
240240 return distinct ( parentWithEventHandler . concat ( mixinsWithEventHandler ) ) ;
241241 }
@@ -246,7 +246,7 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor, iterator: boo
246246 return ( hasConst ? [ i ] : [ ] ) . concat ( getParentsWithConstant ( i ) ) ;
247247 }
248248
249- const mixinsWithConstant = flatMap ( i . implements || [ ] , i => getParentConstant ( allInterfacesMap [ i ] ) ) ;
249+ const mixinsWithConstant = ( i . implements || [ ] ) . flatMap ( i => getParentConstant ( allInterfacesMap [ i ] ) ) ;
250250
251251 return distinct ( mixinsWithConstant ) ;
252252 }
0 commit comments