js-ast-utils: Clone array when passing in nodes to getBindingIdentifiers
MODIFY
packages/@romejs/js-ast-utils/getBindingIdentifiers.ts
packages/@romejs/js-ast-utils/getBindingIdentifiers.ts
@@ -12,7 +12,9 @@ export default function getBindingIdentifiers(
node: AnyNode | Array<AnyNode>,
): Array<BindingIdentifier> {
const ids: Array<BindingIdentifier> = [];
- let queue: Array<undefined | AnyNode> = Array.isArray(node) ? node : [node];
+ let queue: Array<undefined | AnyNode> = Array.isArray(node)
+ ? [...node]
+ : [node];
while (queue.length) {
const node = queue.pop();

js-ast-utils: Clone array when passing in nodes to getBindingIdentifiers