@@ -14,10 +14,6 @@ import {
14
14
import type { Node } from 'ast-types-flow' ;
15
15
import includes from 'array-includes' ;
16
16
import 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' ;
21
17
22
18
import attributesComparator from './attributesComparator' ;
23
19
@@ -62,21 +58,18 @@ const interactiveRoles = new Set(roleKeys
62
58
'toolbar' ,
63
59
) ) ;
64
60
65
- // TODO: convert to use iterFlatMap and iterFrom
66
61
const interactiveElementRoleSchemas = flatMap (
67
62
elementRoleEntries ,
68
63
( [ elementSchema , rolesArr ] ) => ( rolesArr . some ( ( role ) : boolean => interactiveRoles . has ( role ) ) ? [ elementSchema ] : [ ] ) ,
69
64
) ;
70
65
71
- // TODO: convert to use iterFlatMap and iterFrom
72
66
const nonInteractiveElementRoleSchemas = flatMap (
73
67
elementRoleEntries ,
74
68
( [ elementSchema , rolesArr ] ) => ( rolesArr . every ( ( role ) : boolean => nonInteractiveRoles . has ( role ) ) ? [ elementSchema ] : [ ] ) ,
75
69
) ;
76
70
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 ) ) ) ;
78
72
79
- // TODO: convert to use iterFlatMap and iterFrom
80
73
const nonInteractiveElementAXObjectSchemas = flatMap (
81
74
[ ...elementAXObjects ] ,
82
75
( [ elementSchema , AXObjectsArr ] ) => ( AXObjectsArr . every ( ( role ) : boolean => nonInteractiveAXObjects . has ( role ) ) ? [ elementSchema ] : [ ] ) ,
@@ -92,18 +85,18 @@ function checkIsNonInteractiveElement(tagName, attributes): boolean {
92
85
}
93
86
// Check in elementRoles for inherent non-interactive role associations for
94
87
// this element.
95
- const isInherentNonInteractiveElement = some ( iterFrom ( nonInteractiveElementRoleSchemas ) , elementSchemaMatcher ) ;
88
+ const isInherentNonInteractiveElement = nonInteractiveElementRoleSchemas . some ( elementSchemaMatcher ) ;
96
89
if ( isInherentNonInteractiveElement ) {
97
90
return true ;
98
91
}
99
92
// Check in elementRoles for inherent interactive role associations for
100
93
// this element.
101
- const isInherentInteractiveElement = some ( iterFrom ( interactiveElementRoleSchemas ) , elementSchemaMatcher ) ;
94
+ const isInherentInteractiveElement = interactiveElementRoleSchemas . some ( elementSchemaMatcher ) ;
102
95
if ( isInherentInteractiveElement ) {
103
96
return false ;
104
97
}
105
98
// Check in elementAXObjects for AX Tree associations for this element.
106
- const isNonInteractiveAXElement = some ( iterFrom ( nonInteractiveElementAXObjectSchemas ) , elementSchemaMatcher ) ;
99
+ const isNonInteractiveAXElement = nonInteractiveElementAXObjectSchemas . some ( elementSchemaMatcher ) ;
107
100
if ( isNonInteractiveAXElement ) {
108
101
return true ;
109
102
}
0 commit comments