Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including komposit with all npm packages installed. Try it out:

var komposit = require("komposit")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

komposit v0.1.1

For creating functional compositions


For creating functional compositions.


Creates a composite function out of supplied argument functions. komposite(f,g,h)(x) is equivalent to h(g(f(x)))

var add10 = function (n) { return n + 10; };
var divideBy2 = function (n) { return n / 2; };

divideBy2(add10(20)) // 15

var add10AndDivideBy2 = komposit(add10, divide2);

add10AndDivideBy2(20) // 15
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free