Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解构的log如何识别 #9

Open
YWJ-hy opened this issue May 6, 2024 · 3 comments
Open

解构的log如何识别 #9

YWJ-hy opened this issue May 6, 2024 · 3 comments

Comments

@YWJ-hy
Copy link

YWJ-hy commented May 6, 2024

const { log } = console;
log("111")

这种如何识别呢

@baozouai
Copy link
Owner

baozouai commented May 6, 2024

const { log } = console; log("111")

这种如何识别呢

可以看下logMethodReg,https://github.com/baozouai/vite-plugin-enhance-log/blob/master/src/index.ts#L49

https://github.com/baozouai/vite-plugin-enhance-log#%EF%B8%8F-options

@YWJ-hy
Copy link
Author

YWJ-hy commented May 6, 2024

const { log } = console; log("111")
这种如何识别呢

可以看下logMethodReg,https://github.com/baozouai/vite-plugin-enhance-log/blob/master/src/index.ts#L49

https://github.com/baozouai/vite-plugin-enhance-log#%EF%B8%8F-options

不行吧,CallExpression是遍历的函数调用,也就是上面解构出来的log,不能直接匹配"log",怕误判,好像不好处理

@baozouai
Copy link
Owner

baozouai commented May 6, 2024

const { log } = console; log("111")
这种如何识别呢

可以看下logMethodReg,master/src/index.ts#L49
baozouai/vite-plugin-enhance-log#%EF%B8%8F-options

不行吧,CallExpression是遍历的函数调用,也就是上面解构出来的log,不能直接匹配"log",怕误判,好像不好处理

那就不行,你别结构呗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants