One tool that I use on a regular basis when compiling the notes for a Three Devs and a Maybe episode is a tool for converting a clipboard full of links into a Markdown formatted list.
I created this tool a while back in Python and thought it would be interesting to see how it may look in JavaScript when combined with Promises and Async/Await functions.
One feature of ES2015 that I feel can be a stumbling block (but extremely useful) is Arrow Functions lexical scoping of this.
Before this addition, every new function defined its own this - meaning we were required to explicitly bind or locally store the this reference that we desired in many use-cases.
Whilst working today I came across a test helper function that required a few too many parameters.
Debating weather to break the function up, I decided that an elegant solution would be to take advantage of ES2015 object deconstruction and produce a form of ‘Named Parameters’.
Today I stumble upon some code that I did not realise was possible with an array_map function in PHP.
You are able to supply multiple arrays, which in turn will get ‘zipped up’ and passed to the supplied callback as parameters.
This allows for some rather elegant solutions to the ‘index issue’ and accessing keys from within the callback - both of which are easily achieved in an impertivive mindset.