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

记一个filter函数传参的小技巧 #2

Open
ibufu opened this issue Aug 31, 2016 · 0 comments
Open

记一个filter函数传参的小技巧 #2

ibufu opened this issue Aug 31, 2016 · 0 comments

Comments

@ibufu
Copy link
Owner

ibufu commented Aug 31, 2016

const middleware = [
    thunk,
    api,
    !__NODE__ && createLogger(),
].filter(Boolean);

利用Boolean的构造方法作为参数,效果等于

el => !!el
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

1 participant