UNPKG

286 BJavaScriptView Raw
1var _ = require('./_');
2
3_.Promise.prototype.guard = function (type, onRejected) {
4 return this['catch'](function (reason) {
5 if (reason instanceof type && onRejected)
6 return onRejected(reason);
7 else
8 return _.Promise.reject(reason);
9 });
10};