UNPKG

jsonbird

Version:

JSON-RPC 2.0 client/server/peer for any reliable transport. Inter-process communication. REST. WebSocket. WebWorker. Out of order messaging or in-order byte streams

18 lines (13 loc) 363 B
'use strict'; const PromiseFinally = function(callback) { return this.then( value => this.constructor.resolve(callback()).then(() => value), reason => this.constructor.resolve(callback()).then(() => { throw reason; }) ); }; module.exports = promise => { promise.finally = PromiseFinally; return promise; };