Skip to content

Commit

Permalink
chore(*): add file missed in last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Dec 22, 2014
1 parent a6f4872 commit db95239
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dist/commonjs/util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use strict";

exports.processPotential = processPotential;
function processPotential(obj, resolve, reject) {
if (obj && typeof obj.then === "function") {
var dfd = obj.then(resolve);

if (typeof dfd["catch"] === "function") {
return dfd["catch"](reject);
} else if (typeof dfd.fail === "function") {
return dfd.fail(reject);
}

return dfd;
} else {
try {
return resolve(obj);
} catch (error) {
return reject(error);
}
}
}

0 comments on commit db95239

Please sign in to comment.