I'm starting to use ES6 arrow functions more, but haven't found a coding style that I like, especially when chaining them together. e.g., Eric Elliott gives this code:
mix = (...fns) => x => fns.reduce((acc, fn) => fn(acc), x)
And touts how ES6 lets you write it all on "one line of code", but that's partly due to formatting standards, which would require that the function(x) {...}
alternative version to have the { and } on separate lines, etc...
Is there a "coding style standard" (or more likely several) for how that line should be formatted, particularly with newlines?
In my limited research, the Google JavaScript Style Guide and Mozilla Guide are silent.
=>
inside the reduce is not associated with either of the other two=>
s. Spliting that out intoconst call = (arg, fn) => fn(arg); const pipe = (...fns) => x => fns.reduce(call, x)
is much more palatable.