Sha256: da41206c035340c86be13b304a98ffbc5a45e4f1dabb1911eeb36d94346e99b4

Contents?: true

Size: 871 Bytes

Versions: 31

Compression:

Stored size: 871 Bytes

Contents

/* */ 
"format cjs";
/**
 * Prints ComprehensionBlock, prints left and right.
 */

"use strict";

exports.__esModule = true;
exports.ComprehensionBlock = ComprehensionBlock;
exports.ComprehensionExpression = ComprehensionExpression;

function ComprehensionBlock(node, print) {
  this.keyword("for");
  this.push("(");
  print.plain(node.left);
  this.push(" of ");
  print.plain(node.right);
  this.push(")");
}

/**
 * Prints ComprehensionExpression, prints blocks, filter, and body. Handles generators.
 */

function ComprehensionExpression(node, print) {
  this.push(node.generator ? "(" : "[");

  print.join(node.blocks, { separator: " " });
  this.space();

  if (node.filter) {
    this.keyword("if");
    this.push("(");
    print.plain(node.filter);
    this.push(")");
    this.space();
  }

  print.plain(node.body);

  this.push(node.generator ? ")" : "]");
}

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
sequenceserver-3.1.3 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-3.1.2 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-3.1.1 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-3.1.0 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-3.0.1 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-3.0 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.2.0 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.1.0 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.0.0 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.0.0.rc8 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.0.0.rc7 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.0.0.rc6 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.0.0.rc5 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.0.0.rc4 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.0.0.rc3 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.0.0.rc2 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.0.0.rc1 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.0.0.beta4 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.0.0.beta3 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js
sequenceserver-2.0.0.beta1 public/vendor/npm/babel-core@5.8.23/lib/generation/generators/comprehensions.js