@@ -170,20 +170,20 @@ export function findPackageNode(
170170 name : string ,
171171 version ?: string | undefined
172172) : SafeNode | undefined {
173- const queue : Array < { node : typeof tree } > = [ { node : tree } ]
173+ const queue : Array < typeof tree > = [ tree ]
174174 let sentinel = 0
175175 while ( queue . length ) {
176176 if ( sentinel ++ === LOOP_SENTINEL ) {
177177 throw new Error ( 'Detected infinite loop in findPackageNodes' )
178178 }
179- const { node : currentNode } = queue . pop ( ) !
179+ const currentNode = queue . pop ( ) !
180180 const node = currentNode . children . get ( name )
181181 if ( node && ( typeof version !== 'string' || node . version === version ) ) {
182182 return node as unknown as SafeNode
183183 }
184184 const children = [ ...currentNode . children . values ( ) ]
185185 for ( let i = children . length - 1 ; i >= 0 ; i -= 1 ) {
186- queue . push ( { node : children [ i ] as unknown as SafeNode } )
186+ queue . push ( children [ i ] as unknown as SafeNode )
187187 }
188188 }
189189}
@@ -193,21 +193,21 @@ export function findPackageNodes(
193193 name : string ,
194194 version ?: string | undefined
195195) : SafeNode [ ] {
196- const queue : Array < { node : typeof tree } > = [ { node : tree } ]
196+ const queue : Array < typeof tree > = [ tree ]
197197 const matches : SafeNode [ ] = [ ]
198198 let sentinel = 0
199199 while ( queue . length ) {
200200 if ( sentinel ++ === LOOP_SENTINEL ) {
201201 throw new Error ( 'Detected infinite loop in findPackageNodes' )
202202 }
203- const { node : currentNode } = queue . pop ( ) !
203+ const currentNode = queue . pop ( ) !
204204 const node = currentNode . children . get ( name )
205205 if ( node && ( typeof version !== 'string' || node . version === version ) ) {
206206 matches . push ( node as unknown as SafeNode )
207207 }
208208 const children = [ ...currentNode . children . values ( ) ]
209209 for ( let i = children . length - 1 ; i >= 0 ; i -= 1 ) {
210- queue . push ( { node : children [ i ] as unknown as SafeNode } )
210+ queue . push ( children [ i ] as unknown as SafeNode )
211211 }
212212 }
213213 return matches
0 commit comments