You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe add a library of these functions applicable to any ES6 promise, instead of putting them on Promise, but...
/** * Executes the callback for each value serially: the next callback starts once the previous has finished. * If any callback returns an error, the process is stopped and the error returned. */exportfunctiontsSerial<T>(values: T[],callback: (value: T)=>tsPromise.Promise<void>): tsPromise.Promise<void>{if(values.length===0){returntsPromise.Promise.resolve();}vari=0;functiondoTail(): tsPromise.Promise<void>{varp=callback(values[i]);i++;if(i>=values.length){
return p;}else{returnp.then((): tsPromise.Promise<void>=>doTail());}}returndoTail();}
The text was updated successfully, but these errors were encountered:
Maybe add a library of these functions applicable to any ES6 promise, instead of putting them on Promise, but...
The text was updated successfully, but these errors were encountered: