https://github.com/svrao19056/gem-url-builder
This is an utility to build an url leveraging functional programming approaches
https://github.com/svrao19056/gem-url-builder
es2016 functional-programming javascript supertest webpack
Last synced: 3 months ago
JSON representation
This is an utility to build an url leveraging functional programming approaches
- Host: GitHub
- URL: https://github.com/svrao19056/gem-url-builder
- Owner: SVRao19056
- License: mit
- Created: 2020-02-22T23:27:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-31T13:22:38.000Z (about 1 year ago)
- Last Synced: 2025-06-27T12:17:32.058Z (3 months ago)
- Topics: es2016, functional-programming, javascript, supertest, webpack
- Language: JavaScript
- Size: 860 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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.* Integrated with [babel](https://babeljs.io/en/setup#installation) to permit ES 2016 features.
* Integrated with [webpack](https://webpack.js.org/) for deployment.**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](https://jrsinclair.com/articles/2019/elegant-error-handling-with-the-js-either-monad/) 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](https://en.wikipedia.org/wiki/Imperative_programming) .
IMHO I prefer the [functional programming paradigm](https://en.wikipedia.org/wiki/Functional_programming). In this paradigm the prescribed approach is all functions require to be [pure](https://en.wikipedia.org/wiki/Pure_function) There is an ongoing debate but one opinion is that throwing an exception inside the function renders it impure see [here](https://stackoverflow.com/a/12345665).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](https://www.npmjs.com/package/cross-env)
### Other Related References
[Managing environment variables in Nodejs and Modern JS apps](https://medium.com/dubizzletechblog/managing-environment-variables-in-nodejs-and-modern-js-apps-608003f4686c)
## JSDocs documentation
To generate JSDocs documentation run below command in the terminal
> jsdoc src -r -d docs

### References
[JsDoc](https://github.com/jsdoc/jsdoc)
# Acknowledgements
This is an adaptation of the orginal code authored by [James Sinclair](https://jrsinclair.com/articles/2019/elegant-error-handling-with-the-js-either-monad/)
# Pending To Do List
- [] Security Review
- [] Performance Review
- [] Compilance with well known Functional Programming industry standards# References
1. [babel](https://babeljs.io/en/setup#installation)
1. [webpack](https://webpack.js.org/)
1. [JsDoc](https://github.com/jsdoc/jsdoc)
1. [cross-env](https://www.npmjs.com/package/cross-env)
1. [© 2020 James Sinclair](https://jrsinclair.com/articles/2019/elegant-error-handling-with-the-js-either-monad/)