UNPKG

@restnfeel/agentc-starter-kit

Version:

한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템

25 lines (23 loc) 818 B
/** * Like `Promise.allSettled()` but throws an error if any promises are rejected. */ const allSettledWithThrow = async (promises) => { const results = await Promise.allSettled(promises); const rejected = results.filter((result) => result.status === 'rejected'); if (rejected.length) { for (const result of rejected) { console.error(result.reason); } throw new Error(`${rejected.length} promise(s) failed - see the above errors`); } // Note: TS was complaining about using `.filter().map()` here for some reason const values = []; for (const result of results) { if (result.status === 'fulfilled') { values.push(result.value); } } return values; }; export { allSettledWithThrow }; //# sourceMappingURL=Util.js.map