promise-operators
1.0.0 • Public • Published
import {judge, pickUp} from '@jt/promise-operators';
import _ from 'lodash';
async function test() {
try {
const result = await new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
code: 0,
result: {
list: []
}
})
}, 1000);
})
.then(judge(_.isObject))
.then(pickUp(res=>res.result));
} catch(error) {
console.log('请求接口错误');
}
}
Versions
Current Tags
- VersionDownloads (Last 7 Days)
- 1.0.0
0
Version History
- VersionDownloads (Last 7 Days)
- 1.0.0
0
Package Sidebar
Install
Weekly Downloads