https://github.com/invrs/industry-chain
Chain synchronous or async methods using a common parameter namespace
https://github.com/invrs/industry-chain
Last synced: about 1 month ago
JSON representation
Chain synchronous or async methods using a common parameter namespace
- Host: GitHub
- URL: https://github.com/invrs/industry-chain
- Owner: invrs
- Created: 2016-04-10T23:17:38.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-03T07:06:42.000Z (about 10 years ago)
- Last Synced: 2025-11-20T11:02:52.859Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IndustryChain [](https://travis-ci.org/invrs/industry-chain)
Chain synchronous or async methods using a common parameter namespace.
## Requirements
This extension must be paired with [StandardIO](https://github.com/invrs/industry-standard-io) and [Functions](https://github.com/invrs/industry-functions).
## Usage
```js
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!
```