Sha256: a0710e6685155489b1655e326f869fbd34623bc451834c5951a4f935f56d8a76

Contents?: true

Size: 516 Bytes

Versions: 16

Compression:

Stored size: 516 Bytes

Contents

const { printComments } = require("./utils");
const nodes = require("./nodes");

module.exports = (path, opts, print) => {
  const { type, body, comments, start } = path.getValue();

  if (type in nodes) {
    const printed = nodes[type](path, opts, print);

    if (comments) {
      return printComments(printed, start, comments);
    }
    return printed;
  }

  if (type[0] === "@") {
    return body;
  }

  throw new Error(
    `Unsupported node encountered: ${type}\n${JSON.stringify(body, null, 2)}`
  );
};

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
prettier-0.21.0 src/print.js
prettier-0.20.1 src/print.js
prettier-0.20.0 src/print.js
prettier-0.19.1 src/print.js
prettier-0.19.0 src/print.js
prettier-0.18.2 src/print.js
prettier-0.18.1 src/print.js
prettier-0.18.0 src/print.js
prettier-0.17.0 src/print.js
prettier-0.16.0 src/print.js
prettier-0.15.1 src/print.js
prettier-0.15.0 src/print.js
prettier-0.14.0 src/print.js
prettier-0.13.0 src/print.js
prettier-0.12.3 src/print.js
prettier-0.12.2 src/print.js