I have this code for making a post request, sending some data, and logging the return value
$.post '/saveletter', {start: {x: startX, y:startY}, letter: currentLetter, unitVectors: letter.unitVectorsJson(), timeVectors: letter.timeVectorsJson()}, (data) =>
console.log data
I want to split the long parameter object into several lines, for better readability, but can’t figure out the syntax that will work.
To make your code more readable, you can use the following (fiddle and compiled result):
In Coffeescript,
{and}may be omitted from the object literal. And commas may be exchanged for newlines (within an object literal, not between arguments).The following is also valid, but might be less readable (ie not obvious at the first glance):