GitXplorerGitXplorer
s

inspect-compose

public
3 stars
0 forks
0 issues

Commits

List of commits on branch master.
Verified
4307b13e90b446b9b3380fcdc5a9550b84005852

1.0.0

sstevemao committed 8 years ago
Verified
b6d8c989815028a67aa7d68f9cd3d5da34809b42

typo

sstevemao committed 8 years ago
Verified
80c1d40841a8b306f2a3cfed1832188f373ada94

fix node4

sstevemao committed 8 years ago
Verified
3ed10c796e999c19e1966a4bfeb79a1550345555

better error

sstevemao committed 8 years ago
Verified
6ffa0f28dbea1d53f2009951776f42838b2fe753

init

sstevemao committed 8 years ago

README

The README file for this repository.

Problem

var add = curry(function add(x, y){ return x + y });
var map = curry(function map(f, xs){ return xs.map(f) });
var head = function(xs){ return xs[0] };

var inc = add(1);
var incFirst = compose(head, map(inc))

When trying to console.log a function we’re presented with the guts of some internal compose implementation that tells us nothing.

Before

console.log(incFirst)
// function f(result) {
//   for (var i = fns.length - 1; i > -1; i--) {
//     result = fns[i].call(this, result);
//   }
//   return result;
// }

After

console.log(incFirst)
// compose(function (xs){ return xs[0] }, map(add(1)))

See https://medium.com/@drboolean/debugging-functional-7deb4688a08c

Related