src/ruby/nodes/patterns.js in prettier-1.2.3 vs src/ruby/nodes/patterns.js in prettier-1.2.4
- old
+ new
@@ -1,6 +1,7 @@
const {
+ align,
concat,
group,
hardline,
indent,
join,
@@ -72,11 +73,11 @@
function printHshPtn(path, opts, print) {
const [constant, keyValuePairs, keyValueRest] = path.getValue().body;
let args = [];
- if (keyValuePairs) {
+ if (keyValuePairs.length > 0) {
const printPair = (pairPath) => {
const parts = [pairPath.call(print, 0)];
if (pairPath.getValue()[1]) {
parts.push(
@@ -114,13 +115,16 @@
}
function printIn(path, opts, print) {
const parts = [
"in ",
- path.call(
- (valuePath) => printPatternArg(valuePath, opts, print),
- "body",
- 0
+ align(
+ "in ".length,
+ path.call(
+ (valuePath) => printPatternArg(valuePath, opts, print),
+ "body",
+ 0
+ )
),
indent(concat([hardline, path.call(print, "body", 1)]))
];
if (path.getValue().body[2]) {