@soft-treasures/gem-url-builder

1.0.2 • Public • Published

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 to permit ES 2016 features.
  • Integrated with webpack 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 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

Right Class

Left Class

Left Class

Features included

Unit Tests

Unit Tests Screenshot

Test Coverage Report

Includes unit tests with 90+ code coverage see image Test Coverage Report

Get Test Coverage Report

On the on the root folder run this command in the terminal see image below

npm run-script test-coverage

Get Test Coverage Report

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

 Package Documentation

References

JsDoc

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

References

  1. babel
  2. webpack
  3. JsDoc
  4. cross-env
  5. © 2020 James Sinclair

Package Sidebar

Install

npm i @soft-treasures/gem-url-builder

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

691 kB

Total Files

37

Last publish

Collaborators

  • svrao19056