1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| # co-wrap-all
|
| > Call co.wrap for multiple generator functions
|
| This tiny helper allows to easily call `co.wrap` for multiple generator functions.
| For example:
|
| ```javascript
| // Before
| module.exports = {
| foo: co.wrap(foo),
| bar: co.wrap(bar)
| };
|
| // After
| module.exports = wrapAll({foo, bar});
| ```
|
| Also, it is very convenient for defining asynchronous methods:
|
| ```javascript
| // Common
| class Foo {
| * bar(arg) { /* ... */ }
| * baz(arg) { /* ... */ }
| }
|
| // Before
| Foo.prototype.bar = co.wrap(Foo.prototype.bar);
| Foo.prototype.baz = co.wrap(Foo.prototype.baz);
|
| // After
| wrapAll(Foo.prototype);
| ```
|
| ## License
|
| [MIT](https://github.com/connesc/co-wrap-all/blob/master/LICENSE)
|
|