Closed batiste closed 7 years ago
@Gryphon Myers what do you think of this?
Yes, sorry I did have cleaning this up on my mental to-do list. Both good suggestions, and using template literals would also allow for more consistent indentation. I will improve this when I get a moment.
Introduce a function in the generated code and use it
Thinking about this suggestion, it occurred to me that we could reduce bloat overall by introducing a small runtime library. How do you feel about that idea?
@gryphonmyers yeah I would introduce a runtime lib, that sounds like a great idea. Maybe use an external file for this so can be tested easily and independently.
Thanks for the great contribution and tests 👍
[].reduce(function(finalObj, currObj){ for (var propName in currObj) {finalObj[propName] = propName === "class" ? (finalObj[propName] ? finalObj[propName].concat(currObj[propName]) : [currObj[propName]]) : currObj[propName]; } return finalObj; }, {
This code is repeating itself again and again. I have 2 suggestions: