@@ -14,10 +14,6 @@ import {
1414import type { Node } from 'ast-types-flow' ;
1515import includes from 'array-includes' ;
1616import flatMap from 'array.prototype.flatmap' ;
17- import iterFrom from 'es-iterator-helpers/Iterator.from' ;
18- // import iterFlatMap from 'es-iterator-helpers/Iterator.prototype.flatMap';
19- import filter from 'es-iterator-helpers/Iterator.prototype.filter' ;
20- import some from 'es-iterator-helpers/Iterator.prototype.some' ;
2117
2218import attributesComparator from './attributesComparator' ;
2319
@@ -62,21 +58,18 @@ const interactiveRoles = new Set(roleKeys
6258 'toolbar' ,
6359 ) ) ;
6460
65- // TODO: convert to use iterFlatMap and iterFrom
6661const interactiveElementRoleSchemas = flatMap (
6762 elementRoleEntries ,
6863 ( [ elementSchema , rolesArr ] ) => ( rolesArr . some ( ( role ) : boolean => interactiveRoles . has ( role ) ) ? [ elementSchema ] : [ ] ) ,
6964) ;
7065
71- // TODO: convert to use iterFlatMap and iterFrom
7266const nonInteractiveElementRoleSchemas = flatMap (
7367 elementRoleEntries ,
7468 ( [ elementSchema , rolesArr ] ) => ( rolesArr . every ( ( role ) : boolean => nonInteractiveRoles . has ( role ) ) ? [ elementSchema ] : [ ] ) ,
7569) ;
7670
77- const nonInteractiveAXObjects = new Set ( filter ( iterFrom ( AXObjects . keys ( ) ) , ( name ) => includes ( [ 'window' , 'structure' ] , AXObjects . get ( name ) . type ) ) ) ;
71+ const nonInteractiveAXObjects = new Set ( AXObjects . keys ( ) . filter ( ( name ) => includes ( [ 'window' , 'structure' ] , AXObjects . get ( name ) . type ) ) ) ;
7872
79- // TODO: convert to use iterFlatMap and iterFrom
8073const nonInteractiveElementAXObjectSchemas = flatMap (
8174 [ ...elementAXObjects ] ,
8275 ( [ elementSchema , AXObjectsArr ] ) => ( AXObjectsArr . every ( ( role ) : boolean => nonInteractiveAXObjects . has ( role ) ) ? [ elementSchema ] : [ ] ) ,
@@ -92,18 +85,18 @@ function checkIsNonInteractiveElement(tagName, attributes): boolean {
9285 }
9386 // Check in elementRoles for inherent non-interactive role associations for
9487 // this element.
95- const isInherentNonInteractiveElement = some ( iterFrom ( nonInteractiveElementRoleSchemas ) , elementSchemaMatcher ) ;
88+ const isInherentNonInteractiveElement = nonInteractiveElementRoleSchemas . some ( elementSchemaMatcher ) ;
9689 if ( isInherentNonInteractiveElement ) {
9790 return true ;
9891 }
9992 // Check in elementRoles for inherent interactive role associations for
10093 // this element.
101- const isInherentInteractiveElement = some ( iterFrom ( interactiveElementRoleSchemas ) , elementSchemaMatcher ) ;
94+ const isInherentInteractiveElement = interactiveElementRoleSchemas . some ( elementSchemaMatcher ) ;
10295 if ( isInherentInteractiveElement ) {
10396 return false ;
10497 }
10598 // Check in elementAXObjects for AX Tree associations for this element.
106- const isNonInteractiveAXElement = some ( iterFrom ( nonInteractiveElementAXObjectSchemas ) , elementSchemaMatcher ) ;
99+ const isNonInteractiveAXElement = nonInteractiveElementAXObjectSchemas . some ( elementSchemaMatcher ) ;
107100 if ( isNonInteractiveAXElement ) {
108101 return true ;
109102 }
0 commit comments