@soft-treasures/gem-url-builder
v1.0.2
Published
This is an utility to build an url leveraging functional programming approaches
Downloads
5
Maintainers
Readme
gem-url-builder
This is an utility to build an url leveraging functional programming approaches
Disclaimer
This package has not been veiwed through a security and performance lens. This does not claim to be production ready . There are some aspects only that is production ready. This probably will not satisfy the functional programming purists.My justification is that this is a learning process for me and any critical assesment is welcome
Intended Usage
This is to show case a real life production package with all the bells and whistles required for a production ready release. For instance this includes features listed below.
- Manage configuration across various environments
- Extensive Quality checks with unit tests
- Monitor and Attest the Code Quality with code coverage which is one of the prerecquistes for a sucessful agile shop.
This is to meet the need for a production ready approach rather than just a bare bones tutorial meant to demostrate the concepts. However not this is not yet production ready . There are a number of prerequites that are missing. The intent is to provide approaches to some of chalenges that are encountered when a real life production release is attempted.
Architecture Review
This has been inspired by © 2020 James Sinclair who has eloquently proposed this possible solution.
Background Information
This implements elegant error handlying leveraging the Either Monad .The well known industry recomendation is for the application to fail gracefully and provide the consumer/user with an useful message. Generally the solution proposed is cascading try catch blocks in the imperative programming paradigm . IMHO I prefer the functional programming paradigm. In this paradigm the prescribed approach is all functions require to be pure There is an ongoing debate but one opinion is that throwing an exception inside the function renders it impure see here.I agree to this point of view since it no longer is allways deterministic.In some cases there are unintended side effect.
High level Philosophy
In the functional programming paradigm instead of throwing exceptions a Right or Left instance is returned. This objects implement the same interface as is evident from the below screenshots . The Right instance represents the error free object and Left represents the error use case.
Right Class
Left Class
Features included
Unit Tests
Test Coverage Report
Includes unit tests with 90+ code coverage see image
Get Test Coverage Report
On the on the root folder run this command in the terminal see image below
npm run-script test-coverage
Environment Variables
This feature is implemented leveraging cross-env npm package
Other Related References
Managing environment variables in Nodejs and Modern JS apps
JSDocs documentation
To generate JSDocs documentation run below command in the terminal
jsdoc src -r -d docs
References
Acknowledgements
This is an adaptation of the orginal code authored by James Sinclair
Pending To Do List
- [] Security Review
- [] Performance Review
- [] Compilance with well known Functional Programming industry standards