@@ -75,7 +75,7 @@ module.exports = {
75
75
// List of allowed runloop functions
76
76
const allowList = context . options [ 0 ] ?. allowList ?? [ ] ;
77
77
// Maps local names to imported names of imports
78
- const localToImportedNameMap = { } ;
78
+ const localToImportedNameMap = new Map ( ) ;
79
79
80
80
/**
81
81
* Reports a node with usage of a disallowed runloop function
@@ -107,7 +107,7 @@ module.exports = {
107
107
if ( spec . type === 'ImportSpecifier' ) {
108
108
const importedName = spec . imported . name ;
109
109
if ( EMBER_RUNLOOP_FUNCTIONS . includes ( importedName ) ) {
110
- localToImportedNameMap [ spec . local . name ] = importedName ;
110
+ localToImportedNameMap . set ( spec . local . name , importedName ) ;
111
111
}
112
112
}
113
113
}
@@ -118,7 +118,7 @@ module.exports = {
118
118
// Examples: run(...), later(...)
119
119
if ( node . callee . type === 'Identifier' ) {
120
120
const name = node . callee . name ;
121
- const runloopFn = localToImportedNameMap [ name ] ;
121
+ const runloopFn = localToImportedNameMap . get ( name ) ;
122
122
const isNotAllowed = runloopFn && ! allowList . includes ( runloopFn ) ;
123
123
if ( isNotAllowed ) {
124
124
report ( node , runloopFn , name ) ;
@@ -129,7 +129,7 @@ module.exports = {
129
129
// Examples: run.later(...), run.schedule(...)
130
130
if ( node . callee . type === 'MemberExpression' && node . callee . object ?. type === 'Identifier' ) {
131
131
const objectName = node . callee . object . name ;
132
- const objectRunloopFn = localToImportedNameMap [ objectName ] ;
132
+ const objectRunloopFn = localToImportedNameMap . get ( objectName ) ;
133
133
134
134
if ( objectRunloopFn === 'run' && node . callee . property ?. type === 'Identifier' ) {
135
135
const runloopFn = node . callee . property . name ;
0 commit comments