JavaScript Utilities 
This is a collection of useful code snippets that I use over and over.
Maybe they're useful to you as well.
Take away

This is a collection of useful code snippets that I use over and over.
Maybe they're useful to you as well.
Take away

Create a unique string.
Great for quickly creating unique IDs.
https://gist.github.com/SimonHoiberg/ad2710c8626c5a74cddd8f6385795cc0
Great for quickly creating unique IDs.

Generate a random number in a range.
If you need to generate a random number between a minimum and maximum value.
https://gist.github.com/SimonHoiberg/0dc85e01c7c872c3ddc2a409de1232a3
If you need to generate a random number between a minimum and maximum value.

Generate a number range.
It's one of the cool inbuilt utility functions in Python, but unfortunately, we're missing this in JavaScript.
https://gist.github.com/SimonHoiberg/f43ecc90f319fb8737e313b3d47815ee
It's one of the cool inbuilt utility functions in Python, but unfortunately, we're missing this in JavaScript.

Get the last item of either an Array, Set, Map or object.
Great for quickly accessing the last item dynamically without having to make any transformation.
https://gist.github.com/SimonHoiberg/a5645dd55d439e3872c6a63b249f1231
Great for quickly accessing the last item dynamically without having to make any transformation.

Inserting, replacing, and removing items in a list is one of the things we do over and over.
I have these helpers (in TypeScript) that I use everywhere.
https://gist.github.com/SimonHoiberg/c3ec6b028555c79a08a46745baec0d6f
I have these helpers (in TypeScript) that I use everywhere.

Create a deep clone of an object.
It does exactly what you would expect - creating a copy of an object, without any pointers to the original object.
https://gist.github.com/SimonHoiberg/b2a4593d97e60947569df6f78a00b45b
It does exactly what you would expect - creating a copy of an object, without any pointers to the original object.

Deep Freeze an object.
If you enjoy working with immutable JavaScript, this utility function is really handy.
https://gist.github.com/SimonHoiberg/b8f575a30010b185e50627f39ee5fe01
If you enjoy working with immutable JavaScript, this utility function is really handy.

If you've been working with the AWS SDK for Node.js, you probably know that the DynamoDB client returns entries in a quite annoying format.
Use this utility function to unwrap it into a normal-shaped object.
https://gist.github.com/SimonHoiberg/469c2ad3db55b16edbea2c6720d3d83c
Use this utility function to unwrap it into a normal-shaped object.

Sometimes you end up with a lot of Providers in React.
It can make your root component quite nested and hard to read.
Use this utility function to combine a list of Providers into a single Provider.
https://gist.github.com/SimonHoiberg/81cbf7bef73c1c901b85ad8329fd1a09
It can make your root component quite nested and hard to read.
Use this utility function to combine a list of Providers into a single Provider.

Working with async state updates in React often includes a bit of boilerplate.
I created this custom hook to deal with async state.
It optionally supports Recoil atoms as well.
https://gist.github.com/SimonHoiberg/7bebb7074247352e2ac178726adc5c64
I created this custom hook to deal with async state.
It optionally supports Recoil atoms as well.
