babel/lib/6to5/generators/array-comprehensions.js
2014-11-01 19:27:09 +11:00

26 lines
493 B
JavaScript

exports.ComprehensionBlock = function (node, print) {
this.keyword("for");
this.push("(");
print(node.left);
this.push(" of ");
print(node.right);
this.push(")");
};
exports.ComprehensionExpression = function (node, print) {
this.push("[");
this.printJoin(print, node.blocks, " ");
this.push(" ");
if (node.filter) {
this.keyword("if");
this.push("(");
print(node.filter);
this.push(")");
this.push(" ");
}
print(node.body);
this.push("]");
};