Nondeterministic Programming Methodology

    chainof

    1.0.2 • Public • Published

    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()

    Install

    npm i chainof

    DownloadsWeekly Downloads

    0

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • nikezono