Archimedes has baked in some utils that are usually needed in most projects:
- Extended Error
- Is Promise
This is a monad that improves
undefined handling. It implements the null object pattern. It's best used with deep nullable and optional object structures, in other cases you might be better off with using the nullish coalescing operator and optional chaining operator.
You can create a Maybe like so:
When you use a Maybe in order to access a value you have to use the method
This is best used with objects:
You can use the
map method to map an existing value to another one. If the Maybe doesn't have a value then the map is not called. If you want to unwrap a Maybe inside a Maybe you can use the
This utility improves Date handling. Every date you create is in UTC timezone.
A simple fetch wrapper that has improved TypeScript support, middlewares and overall a simpler API than fetch.
This interface allows you to implement the Observer pattern.
Small utility to extend from when creating custom errors in order to maintain proper stack trace for where our error was thrown (only available in V8):