diff --git a/lib/expressions.js b/lib/expressions.js index 6725699..27bafeb 100644 --- a/lib/expressions.js +++ b/lib/expressions.js @@ -71,16 +71,11 @@ class OperationExpression { toJavaScript() { let header = '('; - for (const identifier of this.identifiers) { - if (header.length > 1) { - header += ', '; - } + if (header.length > 1) header += ', '; header += identifier; } - header += ')'; - return `${header} => ${this.toExpression()}`; } } @@ -122,31 +117,23 @@ class ConditionExpression { toExpression() { const ifExpressions = this.clauses.map(({ condition, consequents }) => { const ifExpression = `if ${condition.toExpression()}`; - const consequentExpressions = consequents.map((consequent, i) => i === consequents.length - 1 ? `return ${consequent.toExpression()};` : `${consequent.toExpression()};`, ); - return `${ifExpression} {${consequentExpressions.join(' ')}}`; }); - return ifExpressions.join(' '); } toJavaScript() { let header = '('; - for (const identifier of this.identifiers) { - if (header.length > 1) { - header += ', '; - } + if (header.length > 1) header += ', '; header += identifier; } - header += ')'; - return `${header} => {${this.toExpression()}}`; } }