industry-chain

1.0.0 • Public • Published

IndustryChain Build Status

Chain synchronous or async methods using a common parameter namespace.

Requirements

This extension must be paired with StandardIO and Functions.

Usage

import { factory } from "industry"
import { chain } from "industry-chain"
import { instance } from "industry-instance"
import { functions } from "industry-functions"
import { standard_io } from "industry-standard-io"

class Test {
  hello() {
    return [
      this.getHello,
      this.getWorld,
      this.log
    ]
  }

    getHello() { return { hello: "hello" } }
    
    getWorld({ promise: { resolve } }) {
      setTimeout(() => resolve({ world: "world" }), 10)
    }
    
    log({ hello, world }) { console.log(`${hello} ${world}`) }
}

let test = factory(Test)
  .set("instance", instance)
  .set("functions", functions)
  .set("standard_io", standard_io)
  .set("chain", chain)

test().hello()
  // hello world!

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    2
    • latest

Version History

Package Sidebar

Install

npm i industry-chain

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • winton