@b-jones-rfd/func-help
v0.3.0
Published
Common project utilities and helpers
Downloads
12
Readme
Func Help
Helpers to perform common project tasks. This is an exercise to avoid code reuse in my own projects. Use at your own risk.
Prerequisites
This project requires NodeJS (version >= 20) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.
$ npm -v && node -v
10.2.4
v20.11.1PNPM is a awesome alternative to NPM and is recommended.
Table of contents
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Installation
BEFORE YOU INSTALL: please read the prerequisites
To install and set up the library, run:
$ npm i @b-jones-rfd/func-helpOr if you prefer using Yarn:
$ yarn add @b-jones-rfd/func-helpOr for PNPM:
$ pnpm add @b-jones-rfd/func-helpUsage
TBD
API
Monads
AsyncIO
The AsyncIO monad captures side‑effectful asynchronous computations in a safe, referentially transparent wrapper that can be composed without executing the effects until ".run()" is invoked.
AsyncIO<A>Either
Either represents a value that is either a Left (typically an error) or a Right (a successful computation).
Either<L, R>Except
Except is represents a value that is either an Error or a success value. This is a helper for the Either monad using Error for the Left type and simplified semantics.
Except<A>IO
The IO monad captures side‑effectful computations in a safe, referentially transparent wrapper that can be composed without executing the effects until ".run()" is invoked.
IO<A>State
Implementation of the State monad
State<S, A>StateT
This transformer lets you add mutable‑state semantics on top of an arbitrary underlying monad (IO, Either, Promise …) without executing the stateful logic until the final "run" call.
StateT<S, A>Utilities
Do
Do provides static helpers to interpret generator functions as monadic “do” blocks.
Contributing
This is a pet project to save me time at work. It is still under development and you should use at your own risk.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- B Jones RFD - Package Noob - B-Jones-RFD
