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 lazy-chain with all npm packages installed. Try it out:

var lazyChain = require("lazy-chain")

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

lazy-chain v2.0.0

Lazily chain with proxies.

Lazy Chain


Build Status js-standard-style codecov

A library to allow easy method chaining with es6 proxies.



First run npm install lazy-chain then require the file

const LazyChain = require("lazy-chain")

Or include the direct file

<script src="./npm_modules/lazy-chain/index.js"></script>



//Create a new LazyList
const LazyChain = require('lazy-chain')
const lazy = LazyChain() //Or use new


Chaining runs a series of methods on the fed object, and then returns the modified object

//Chain together a series of methods
lazy.forEach((value) => {

//Feed the chain an object
lazy.chain([3, 4, 5]) //Becomes [3, 4, 5, 7, 8]
lazy.chain(['hello', true]) //Becomes ['hello', true, 7, 8]


Piping runs a series of methods, running each sequencial method on the previous methods output, and then returns the output of the last method.

//Chain together some methods => {
  return value+1
}) => {
  return value*2

//Feed the pipeline the first value
lazy.pipe([1, 2]) //Becomes [5, 6]
lazy.pipe([3, 4]) //Becomes [8, 10]
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