Sha256: 8b85ea99a74c1b490d61cfd4f6454fb1b3d7e65b386eb79e940ddf4adb6d30a9
Contents?: true
Size: 1.84 KB
Versions: 5
Compression:
Stored size: 1.84 KB
Contents
const { concat, group, indent, join, line, softline } = require("../prettier"); const { makeList } = require("../utils"); module.exports = { massign: (path, opts, print) => { let right = path.call(print, "body", 1); if ( ["mrhs_add_star", "mrhs_new_from_args"].includes( path.getValue().body[1].type ) ) { right = group(join(concat([",", line]), right)); } return group( concat([ group(join(concat([",", line]), path.call(print, "body", 0))), " =", indent(concat([line, right])) ]) ); }, mlhs: makeList, mlhs_add_post: (path, opts, print) => path.call(print, "body", 0).concat(path.call(print, "body", 1)), mlhs_add_star: (path, opts, print) => path .call(print, "body", 0) .concat([ path.getValue().body[1] ? concat(["*", path.call(print, "body", 1)]) : "*" ]), mlhs_paren: (path, opts, print) => { if (["massign", "mlhs_paren"].includes(path.getParentNode().type)) { // If we're nested in brackets as part of the left hand side of an // assignment, i.e., (a, b, c) = 1, 2, 3 // ignore the current node and just go straight to the content return path.call(print, "body", 0); } return group( concat([ "(", indent( concat([ softline, join(concat([",", line]), path.call(print, "body", 0)) ]) ), concat([softline, ")"]) ]) ); }, mrhs: makeList, mrhs_add_star: (path, opts, print) => path .call(print, "body", 0) .concat([concat(["*", path.call(print, "body", 1)])]), mrhs_new_from_args: (path, opts, print) => { const parts = path.call(print, "body", 0); if (path.getValue().body.length > 1) { parts.push(path.call(print, "body", 1)); } return parts; } };
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
prettier-0.15.1 | src/nodes/massign.js |
prettier-0.15.0 | src/nodes/massign.js |
prettier-0.14.0 | src/nodes/massign.js |
prettier-0.13.0 | src/nodes/massign.js |
prettier-0.12.3 | src/nodes/massign.js |