Here's the generated JavaScript with better indentation:
_(gameState.loot).pick(function(value, key) {
return key !== "pickUpAnimations";
}).filter(
(function(d) {
return _.isArray(d);
}).reduce((function(sum, d) {
return sum.concat(d);
}))
);
As you can see, .filter (...
and .filter(...
are not the same. Two possible fixes:
Remove the whitespace between the method names and the opening parentheses:
_(gameState.loot) .pick((value, key) -> key isnt "pickUpAnimations") .filter((d) -> _.isArray (d)) .reduce((sum, d) -> sum.concat (d))
Remove the parentheses entirely:
_(gameState.loot) .pick (value, key) -> key isnt "pickUpAnimations" .filter (d) -> _.isArray (d) .reduce (sum, d) -> sum.concat (d)
You can also get rid of the anonymous function calling _.isArray
:
_(gameState.loot)
.pick (value, key) -> key isnt "pickUpAnimations"
.filter _.isArray
.reduce (sum, d) -> sum.concat (d)