Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions babel-preset/configs/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@
var resolvePlugins = require('../lib/resolvePlugins');

const getPreset = (src, options) => {
const plugins = [];
const isNull = src === null || src === undefined;
const hasClass = isNull || src.indexOf('class') !== -1;
const hasForOf =
isNull || (src.indexOf('for') !== -1 && src.indexOf('of') !== -1);

plugins.push(
const plugins = [
'syntax-class-properties',
'syntax-trailing-function-commas',
'transform-class-properties',
Expand All @@ -38,7 +32,11 @@ const getPreset = (src, options) => {
'transform-es2015-modules-commonjs',
{strict: false, allowTopLevelThis: true},
],
);
];
const isNull = src === null || src === undefined;
const hasClass = isNull || src.indexOf('class') !== -1;
const hasForOf =
isNull || (src.indexOf('for') !== -1 && src.indexOf('of') !== -1);

if (isNull || src.indexOf('async') !== -1 || src.indexOf('await') !== -1) {
plugins.push('syntax-async-functions');
Expand Down