blob: c3edece7441ac632b06ac4358f9b33e9b1151bc3 [file] [log] [blame]
40 columns |
>>> Unsplit.
function ( first : 123 , second : 345 ) ;
<<<
function(first: 123, second: 345);
>>> Split arguments and add trailing comma.
function ( one: "value" , two: "data" , three: "more stuff" ) ;
<<<
function(
one: "value",
two: "data",
three: "more stuff",
);
>>> Mixed named and positional.
f(one: 1, "pos", two: 2, "itional");
<<<
f(one: 1, "pos", two: 2, "itional");
>>> Mixed named and positional split.
function(one: 1, "pos", two: 2, "itional");
<<<
function(
one: 1,
"pos",
two: 2,
"itional",
);
>>> Split after argument name.
function(veryLongParameterName: veryLong + argument + expression);
<<<
function(
veryLongParameterName:
veryLong + argument + expression,
);
>>> Use block-like formatting for arguments that are delimited expressions.
function(list: [element1, element2, element3, element4],
map: {entry1: valueOne, entry2: valueTwo},
call: function(argument1, argument2, argument3));
<<<
function(
list: [
element1,
element2,
element3,
element4,
],
map: {
entry1: valueOne,
entry2: valueTwo,
},
call: function(
argument1,
argument2,
argument3,
),
);
>>> Block-like formatting for a block-bodied function with unsplit parameters.
function(name: (param, another) { body; });
<<<
function(
name: (param, another) {
body;
},
);
>>> No block-like formatting for a block-bodied function with split parameters.
function(name: (longParameter, anotherLongParameter) { body; });
<<< 3.7
function(
name: (
longParameter,
anotherLongParameter,
) {
body;
},
);
<<< 3.8
function(
name:
(
longParameter,
anotherLongParameter,
) {
body;
},
);
>>> Headline formatting for a split `=>` function.
function(name: (param, another) => veryLongBody);
<<< 3.7
function(
name:
(param, another) => veryLongBody,
);
<<< 3.8
function(
name: (param, another) =>
veryLongBody,
);
>>> Block-like formatting of a `=>` body containing a function call.
function(name: (param) => another(argument1, argument2, argument3));
<<< 3.7
function(
name:
(param) => another(
argument1,
argument2,
argument3,
),
);
<<< 3.8
function(
name: (param) => another(
argument1,
argument2,
argument3,
),
);