Sha256: 9f3e503460af017c644483e6c1b0d9fd453a5eb94201986783ceb06ff3aef2ab
Contents?: true
Size: 1.31 KB
Versions: 8
Compression:
Stored size: 1.31 KB
Contents
const { concat, group, indent, line, softline } = require("../prettier"); module.exports = { binary: (path, opts, print) => { const operator = path.getValue().body[1]; const useNoSpace = operator === "**"; return group( concat([ concat([path.call(print, "body", 0), useNoSpace ? "" : " "]), operator, indent( concat([useNoSpace ? softline : line, path.call(print, "body", 2)]) ) ]) ); }, dot2: (path, opts, print) => concat([ path.call(print, "body", 0), "..", path.getValue().body[1] ? path.call(print, "body", 1) : "" ]), dot3: (path, opts, print) => concat([ path.call(print, "body", 0), "...", path.getValue().body[1] ? path.call(print, "body", 1) : "" ]), unary: (path, opts, print) => { const oper = path.getValue().body[0]; const doc = path.call(print, "body", 1); if (oper === "not") { // For the `not` operator, we're explicitly making the space character // another element in the `concat` because there are some circumstances // where we need to force parentheses (e.g., ternaries). In that case the // printer for those nodes can just take out the space and put in parens. return concat(["not", " ", doc]); } return concat([oper[0], doc]); } };
Version data entries
8 entries across 8 versions & 1 rubygems