Sha256: 21e3f027ed39d3ad3b0058b10da83b5a94bb91281d43a24e599dc9f6feb18f28
Contents?: true
Size: 1.06 KB
Versions: 15
Compression:
Stored size: 1.06 KB
Contents
const { concat, group, indent, join, line } = require("../prettier"); const { concatBody, first, skipAssignIndent } = require("../utils"); module.exports = { assign: (path, opts, print) => { const [printedTarget, printedValue] = path.map(print, "body"); let adjustedValue = printedValue; if ( ["mrhs_add_star", "mrhs_new_from_args"].includes( path.getValue().body[1].type ) ) { adjustedValue = group(join(concat([",", line]), printedValue)); } if (skipAssignIndent(path.getValue().body[1])) { return group(concat([printedTarget, " = ", adjustedValue])); } return group( concat([printedTarget, " =", indent(concat([line, adjustedValue]))]) ); }, assign_error: (_path, _opts, _print) => { throw new Error("Can't set variable"); }, opassign: (path, opts, print) => group( concat([ path.call(print, "body", 0), " ", path.call(print, "body", 1), indent(concat([line, path.call(print, "body", 2)])) ]) ), var_field: concatBody, var_ref: first };
Version data entries
15 entries across 15 versions & 1 rubygems