functional programming js

Code Samples Functional Programming in JavaScript, Manning 2016

444
159
JavaScript

Functional JavaScript Programming

By Luis Atencio

Since this code uses ES6 artifacts, any code meant to run on the browser must be transpiled with either:

  • Babel
  • Traceur

For Node.js users. This code requires:

node --version > 6.3.1

Please begin the project with

$ npm install

to load all of the required functional libraries.

In this repo you will find:

  • All code samples (as runnable unit tests) of code used in chapters
  • JS targeted for browser
  • Functional data types like Optional, Either, Maybe, etc.
  • Access to some JavaScript functional libraries like lodash.js, rxjs, etc.

Running the tests

QUnit

Once QUnit is installed, you can run each test with the QUnit CLI by specifying the chapter number.

$ npm run ch[01-08]

Jest

Additionally, you may also run unit tests using the Jest test runner.
Disclaimer: This is not part of the book, but an extra feature courtesy of the JS community 😃

To run all tests:

$ npm test

To run a chapter test:

$ jest ch[01-08]

To run tests in watch mode:

$ jest --watchAll

And for code coverage:

$ npm run cover