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

Fix plugins transform with array #85

Merged
merged 3 commits into from
Mar 23, 2019
Merged

Conversation

isacjunior
Copy link
Contributor

Issue #84

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of replacing the old plugin with an array of plugins and then, in a separate place, flatten the plugins list, I'd prefer if at

if (name === null) {
plugins.splice(i, 1);
i--;
} else {
if (isArray) plugin[0] = name;
else plugin = name;
plugins[i] = upgradeOptions(plugin);
}
we check if name is an array and handle it there.

function flattenPlugins(arr) {
let newArr = [];
arr && arr.forEach(a => {
const secondIsObject = typeof a[1] === 'object'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can also be false or undefined.

@danez danez merged commit da41fce into babel:master Mar 23, 2019
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

Successfully merging this pull request may close these issues.

3 participants