File tree Expand file tree Collapse file tree 1 file changed +0
-32
lines changed Expand file tree Collapse file tree 1 file changed +0
-32
lines changed Original file line number Diff line number Diff line change @@ -187,35 +187,3 @@ export function syncPromiseReject<T = never>(reason?: any): PromiseLike<T> {
187187 reject ( reason ) ;
188188 } ) ;
189189}
190-
191- /** JSDoc */
192- export function syncPromiseAll < U = any > ( collection : Array < U | PromiseLike < U > > ) : PromiseLike < U [ ] > {
193- return new SyncPromise < U [ ] > ( ( resolve , reject ) => {
194- if ( ! Array . isArray ( collection ) ) {
195- reject ( new TypeError ( `Promise.all requires an array as input.` ) ) ;
196- return ;
197- }
198-
199- if ( collection . length === 0 ) {
200- resolve ( [ ] ) ;
201- return ;
202- }
203-
204- let counter = collection . length ;
205- const resolvedCollection : U [ ] = [ ] ;
206-
207- collection . forEach ( ( item , index ) => {
208- void syncPromiseResolve ( item )
209- . then ( value => {
210- resolvedCollection [ index ] = value ;
211- counter -= 1 ;
212-
213- if ( counter !== 0 ) {
214- return ;
215- }
216- resolve ( resolvedCollection ) ;
217- } )
218- . then ( null , reject ) ;
219- } ) ;
220- } ) ;
221- }
You can’t perform that action at this time.
0 commit comments