Teaser image of Hey There Module

Hey There Module

eccentric-j/hey-there
  • JS

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

  1. Started by writing out ideal interface code instead of implementation
  2. Ran it by coworkers to collect feedback on syntax and if the project is a good idea
  3. Implemented the library in node.js using now native ES2015 features
  4. 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.