Update: I just chucked this up on npm so you can use it with:
npm i @small-tech/required
(See what I did there?) ;)
@aral Ha, clever trick! 😃
I stay away from JS, but thought Typescript would do this already
Clever solution though
@aral cool trick, if you haven't done it already you should add a call to Error.captureStackTrace so your util functions aren't included in the stack trace
@Paul Good call (no pun intended) ;)
@Paul Done – thanks again ;) https://source.small-tech.org/aral/required/-/blob/master/CHANGELOG.md
[Not related to the main topic ->] the RORO pattern can be useful on the long term when you need to add, rename or remove arguments to or from your functions.
@severo_bo Neat – thanks for the heads up :) I did do a cursory search to see if there was anything else out there but didn’t stumble on that :)
@severo_bo (I’m also a big fan of using parameter objects once you’re past a couple of paramaters for most things) :)
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!