开发者社区> 镜像站> NPM> industry-chain
industry-chain
Chain synchronous or async methods using a common parameter namespace.
Last updated 4 years ago by winton .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install industry-chain 
SYNC missed versions from official npm registry.

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!

Current Tags

  • 1.0.0                                ...           latest (4 years ago)

9 Versions

  • 1.0.0                                ...           4 years ago
  • 0.5.2                                ...           4 years ago
  • 0.5.1                                ...           4 years ago
  • 0.5.0                                ...           4 years ago
  • 0.4.0                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.1                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dependents (1)