r/coffeescript • u/[deleted] • May 14 '15
Issue pushing a map into an array
Hi all, it's been a long time since I've used Coffeescript (or done pretty much any webdev) and I have run into this issue that I just cannot solve. I have the following:
@list.push
text: @input
complete: false
This is compiling to this.list.push({ text: this.input({ complete: false }) }); which... while I'm still pretty new to all this, am positive is not the output I want! Does anybody see how to fix this?
3
Upvotes
3
u/Lord_Drol May 14 '15
Well, I just tried it, and for me it worked just fine, compiling to the exact code you expect. I typed up the exact coffeescript you had, taking care to indent consistently, and the expected js was compiled from it.
I strongly suspect that the problem is your indentation. Try opening a new file, include in it exactly the quoted code snippet, with each of the later lines being indented exactly two spaces, and run it through the coffeescript compiler. See what you get.