src/nodes/patterns.js in prettier-1.1.0 vs src/nodes/patterns.js in prettier-1.2.0
- old
+ new
@@ -46,10 +46,26 @@
}
return args;
}
+function printFndPtn(path, opts, print) {
+ const [constant] = path.getValue().body;
+
+ let args = [path.call(print, "body", 1)]
+ .concat(path.map(print, "body", 2))
+ .concat(path.call(print, "body", 3));
+
+ args = concat(["[", group(join(concat([",", line]), args)), "]"]);
+
+ if (constant) {
+ return concat([path.call(print, "body", 0), args]);
+ }
+
+ return args;
+}
+
function printHshPtn(path, opts, print) {
const [constant, keyValuePairs, keyValueRest] = path.getValue().body;
let args = [];
if (keyValuePairs) {
@@ -111,8 +127,9 @@
return group(concat(parts));
}
module.exports = {
aryptn: printAryPtn,
+ fndptn: printFndPtn,
hshptn: printHshPtn,
in: printIn
};