I get the feeling this approach won't work well with files such as foo.bar.js. You may want to reverse() after splitting and picking the first entry as extension instead.
User centric frontend specialist between "normal" programming and design. Loves perf and minimalism. Prefers HTML, CSS, Web Standards over JS, UX over DX. Hates div disease.
I love how we can get the extension of a file name like so:
I get the feeling this approach won't work well with files such as
foo.bar.js
. You may want to reverse() after splitting and picking the first entry as extension instead.Or if you must have destructure:
But whichever solution that actually is able to select the very last part will work.