wavesoft / dot-dom

.dom is a tiny (512 byte) template engine that uses virtual DOM and some of react principles
Apache License 2.0
809 stars 53 forks source link

Unused variable _reserved #59

Closed mindplay-dk closed 4 years ago

mindplay-dk commented 4 years ago

Looks like there's an unused variable _reserved in render().

I think you can scrap that and save 2 bytes?

Not sure, terser might be detecting it and removing it already, but it's unused either way.

wavesoft commented 4 years ago

Not really 😉

This _reserved argument is the third to the map callback. It will be populated with the reference of the array. This means that it will have a value, and the initialisation trick won't work. (Check MDN for more details)

I tried using this variable as a temporary storage, but apparently it ended up increasing the compressed result.

mindplay-dk commented 4 years ago

Ah, so this is just a throw-away variable so you can abuse the unused arguments as a shorthand to define variables, gotcha 😉