Skip to content

Latest commit

 

History

History
13 lines (11 loc) · 269 Bytes

2018-06-21__Promise.prototype.finally.md

File metadata and controls

13 lines (11 loc) · 269 Bytes

Promise.prototype.finally

polyfill

Promise.prototype.finally = callback => {
  return this.then(value => {
    return Promise.resolve(callback()).then(() => value)
  }, error => {
    return Promise.resolve(callback()).then(() => throw error)
  })
}