Hey There Module
A node JS library to manage exports more expressively to make them easier to test.
Goal
After getting into functional programming I found myself having a hard time working with node’s exports. When exporting pure functions it is difficult to mock side-effects compared to OOP classes which allow overriding a method or property. I wanted a way to manage exports more simply and make it easy to stub them out for unit tests.
Process
- Started by writing out ideal interface code instead of implementation
- Ran it by coworkers to collect feedback on syntax and if the project is a good idea
- Implemented the library in node.js using now native ES2015 features
- Wrote unit tests
Discoveries
- Learned the internals of node’s require system
- Gained experience working with pure functions
- Gained better understanding of trade-offs focusing on functional-programming in node.