[Babylon] Take the first set of options for plugins (#7994)
* [Babylon] Take the first set of options for plugins * Fix test * Docs
This commit is contained in:
committed by
Logan Smyth
parent
555ee80f43
commit
6eab6f5863
@@ -33,8 +33,8 @@ export default class Parser extends StatementParser {
|
||||
function pluginsMap(plugins: PluginList): PluginsMap {
|
||||
const pluginMap: PluginsMap = (Object.create(null): Object);
|
||||
for (const plugin of plugins) {
|
||||
if (Array.isArray(plugin)) pluginMap[plugin[0]] = plugin[1] || {};
|
||||
else pluginMap[plugin] = {};
|
||||
const [name, options = {}] = Array.isArray(plugin) ? plugin : [plugin, {}];
|
||||
if (!pluginMap[name]) pluginMap[name] = options || {};
|
||||
}
|
||||
return pluginMap;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user