Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Exercises in functional programming on JavaScript

License

Notifications You must be signed in to change notification settings

DmitryBarskov/js-fp-exercises

Repository files navigation

js-fp-exercises

Exercise in functional programming!

How to

First clone or fork this repository. Second pick up an exercise (see index section).

Each exercise directory consists of 3 files:

  • README.md - the description of the exercise
  • index.test.js - this file has tests for your solution. The tests are disabled in the beginning, to make a test work enable it:
    @@ -1,6 +1,6 @@
     import uncurry from ".";
    
    -describe.skip("uncurry", () => {
    +describe("uncurry", () => {
       const curriedSum = (a) => (b) => a + b;
    
       const regularSum = uncurry(curriedSum);
  • index.js - solution boilerplate, edit this file to make the tests pass

Use npm test to run the test suite or npm test -- src/<exercise> to run specific exercise.

Index

  1. factorial
  2. curry
  3. uncurry