Closed danielo515 closed 6 years ago
Yeah, that one's a bit annoying. https://github.com/gkz/LiveScript/issues/1000#issuecomment-358728417
-> [] =
* a: 1
* a: 2
curly brackets improve (imo) visual look of the blocks:
makeQuestions = ({dependencies, devDependencies}) ->
return
{
type: \input
name: \pkg.name
message: 'Name the package'
filter: (.split ' ' .join \- .toLowerCase!)
}
{
type: \confirm
name: \meta.babel
message: 'Is this a babel plugin ?'
default: false
}
...
Leaving curly braces apart is one of the reasons why I switched to livescript
The gkz-recommended way to do this (#421) is:
makeQuestions = ({dependencies, devDependencies}) ->
* * type: \input
name: \pkg.name
message: 'Name the package'
filter: (.split ' ' .join \- .toLowerCase!)
* type: \confirm
name: \meta.babel
message: 'Is this a babel plugin ?'
default: false
See also #512, #784 for some more discussion. I'm going to close this as a duplicate; I think those issues and #1000 already cover that there is some awkwardness around this syntax.
Hello, I want to build a function that returns an array of objects. The array is quite large, so I want it to define vertically. However, the compiler does weird things, the only workaround I found is this:
this returns the assignment, but I find ridiculous to create an unused variable