JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q36392F
  • License ISC

Lazily chain with proxies.

Package Exports

  • lazy-chain

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lazy-chain) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

LazyChain

Build Status npm version js-standard-style

A library to allow easy method chaining with es6 proxies.

Usage

npm install lazy-chain

Then in your js file

const LazyChain = require('Lazy-Chain')
var chain = new LazyChain()
//Then chain methods
chain.push(7)
chain.reverse()
chain.forEach((value) => {
    console.log(value)
})
//The chain can now be fed objects
chain.run([1, 2, 3])
chain.run([7, 3, 8])

Output

The output from LazyChain.prototype.run is defined as

{
  obj: /* The final mutated object */,
  results: [ /* The returned values from each function */ ]
}

Notes

  • It is possible to chain any method
  • It is possible to use any object
  • The methods are chained onto the original object, not each others output
  • Node must be run with the flags --harmony-proxies --harmony
  • The LazyChain's run method supersedes the run method of any object fed to it