只做了一点微小的工作。
You can install it as dependency via npm
.
$ npm install tinywork --save
// or
$ cnpm install tinywork --save
tinywork can process mix Promise list or mix Object.
You can use co
and yield
like this:
yield tinywork({
a: Promise.resolve(1),
b: Promise.resolve(2),
c: 'c'
});
// =>
{
a: 1,
b: 2,
c: 'c'
}
And use async/await
like this:
await tinywork({
a: Promise.resolve(1),
b: Promise.resolve(2),
c: 'c'
});
// =>
{
a: 1,
b: 2,
c: 'c'
}
You can use co
and yield
like this:
yield tinywork([
Promise.resolve(1),
Promise.resolve(2),
'c'
]);
// =>
[1, 2, 'c'];
And use async/await
like this:
await tinywork([
Promise.resolve(1),
Promise.resolve(2),
'c'
]);
// =>
[1, 2, 'c'];
Just return resolved Promise with value.
The MIT license