Code Buckets

Buckets of code

Helpful Starter Projects for React and Node

Here are some simple starter projects for Node and React I’m using. I’ve got a bit sick of using create-react-app and seeing a mountain of security vulnerabilities before I even start. The number of errors seems to range from 5…

Is there any reason not to use TypeScript?

I’ve written a lot of code for side projects and for this blog, and a lot of it has been JavaScript. I’m really wondering now why I didn’t write it all in TypeScript instead. It’s easy to learn, improves your…

Getting Random Letters with the Correct Frequency Using TypeScript

The Task It’s pretty easy to get a random letter using TypeScript. Using lodash and returning upper case letters, it would be You don’t even need to use lodash – it’s a convenience. The problem with this code is that…

Extending TypeScript to serialise Map objects to JSON

The collection objects offered by ES6 such as Map and Set are indeed a marvel. One notable downside to them though is that they don’t serialise to JSON. For example JSON.stringify(MyMapObject); Results in {} Always – irrespective of what is…

LINQ FirstOrDefault implementation in TypeScript

Confession: when working in JavaScript languages I kind of miss some C# things such as LINQ. A substantial part of my C# coding seemed to be chaining LINQ operators together. So rather than staring wistfully out of the window  in…