Socket
Book a DemoInstallSign in
Socket

inspect-compose

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inspect-compose

compose with debuggable glory

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

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

Keywords

curry

FAQs

Package last updated on 21 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts