Socket
Socket
Sign inDemoInstall

chainof

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    chainof

chain functions like `Connect`. for Chain Of Responsibility.


Version published
Weekly downloads
2
decreased by-75%
Maintainers
1
Install size
3.18 kB
Created
Weekly downloads
 

Readme

Source

chainof Build Status

NPM

function chain,like connect

##install

using npm:

npm install chainof

*or using package.json:

"chainof": "*"

##Example

# CoffeeScript
ChainOf = require 'chainof'
chain   = new ChainOf

chain.use (args,next)->
  next()
chain.use (args,next)->
  args.ping = "pong"
  next()
testFunc = (args,next)->
  args.pong = -> return "func"
  next()
chain.use testFunc
chain.use ->
  return "hoge"
chain.use ->
  return "never"

chain.length() # -> 4
res = chain.run() # -> "hoge". not "never"
chain.variables.ping # -> "pong"
chain.variables.pong() #-> "func"

APIs

  • chain.clear()
  • chain.length()
  • chain.add(Function func)
    • function(args,next)
  • chain.run()

Keywords

FAQs

Last updated on 09 Apr 2014

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc