Skip to content

Commit

Permalink
fix: furthur improve iife matching
Browse files Browse the repository at this point in the history
  • Loading branch information
pionxzh committed May 1, 2024
1 parent a1b56f1 commit 8546f81
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/ast-utils/src/matchers/isIIFE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import type { ASTNode, ASTPath, CallExpression, Collection, ExpressionStatement,
* ```js
* (() => { ... })(...)
* (function() { ... })(...)
* ```
*
* @example
* ```js
* !(() => { ... })(...)
* !function() { ... }(...)
* ```
*/
Expand All @@ -25,10 +22,7 @@ export function isStatementIIFE(j: JSCodeshift, node: Statement): node is Expres
* ```js
* (() => { ... })(...)
* (function() { ... })(...)
* ```
*
* @example
* ```js
* !(() => { ... })(...)
* !function() { ... }(...)
* ```
*/
Expand Down Expand Up @@ -73,6 +67,12 @@ export function findIIFEs(
operator: '!',
argument: {
type: 'CallExpression',
callee: {
type: (type: string) => {
return type === 'FunctionExpression'
|| type === 'ArrowFunctionExpression'
},
},
},
},
})
Expand Down

0 comments on commit 8546f81

Please sign in to comment.