-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Replace lodash/map with array equivalent #7550
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/7208/ |
@@ -220,7 +219,7 @@ export const list = { | |||
*/ | |||
|
|||
VariableDeclaration(node: Object): Array<Object> { | |||
return map(node.declarations, "init"); | |||
return node.declarations ? node.declarations.map(decl => decl.init) : []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is declarations
nullable?
Looking at other parts of the code we already used node.declarations without checking null, so it probably isn't. Also codecoverage says that the else branch here is never triggered. I change it. |
* Replace lodash/map with array equivalent * Fix review comments
I#m working on improving babel-standalone and noticed that this is totally unnecessary as
arr.map()
should be supported everywhere.