schmod / babel-plugin-angularjs-annotate

Add Angular 1.x dependency injection annotations to ES6 code
http://schmod.github.io/babel-plugin-angularjs-annotate
MIT License
240 stars 29 forks source link

Avoid error when state.children is a function call (CallExpression) #34

Open leonid-shevtsov opened 6 years ago

leonid-shevtsov commented 6 years ago

I encountered an error when the value of a children property was a function call, not an array.

Specific example:

children: angular.copy(initialStateArrayThatIsReused)

I'm not experienced with Babel enough to explain why this happens - getting elements seems reliable enough to me. But, adding an explicit check that children is an array makes the problem go away.

I'm using Babel version 6.26.0.