uniform parameters
- Dominant language
- JavaScript
- Stars
- 91
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
This is just a question/idea post:
Sometimes I accidentally do not list the correct parameters in the next task in the waterfall:
```
waterfall([
(cb) => fs.ensureDir('/tmp/x', cb),
(cb) => fs.readFile('/tmp/y', cb)
], callback)
```
In the above I forgot that `fs.ensureDir` returns the directory path, so I'll have a bug where `cb` in the second task is assigned to the wrong thing, and it'll take me a while to catch. For an api with sparse documentation, sometimes I dont really know what arguments the callback will have. This is more tricky when the callback takes several arguments. So I was thinking of making a variation of `run-waterfall` (`run-waterfall-uniform`?) that always has tasks with two parameters, where the first parameter is always the array of callback arguments, and the second parameter is always the callback function:
```js
waterfall([
(cb) => fs.ensureDir('/tmp/x', cb),
([dir], cb) => fs.readFile('/tmp/y', cb),
([contents], cb) => etc
], callback)
```
The advantage is just that I know my `cb` will always get assigned correctly. Whaddya think?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.