From db95239c071d9cda87957a34744f2f8f32f64e7b Mon Sep 17 00:00:00 2001 From: Rob Eisenberg Date: Mon, 22 Dec 2014 01:17:34 -0500 Subject: [PATCH] chore(*): add file missed in last commit --- dist/commonjs/util.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 dist/commonjs/util.js diff --git a/dist/commonjs/util.js b/dist/commonjs/util.js new file mode 100644 index 00000000..b7d15939 --- /dev/null +++ b/dist/commonjs/util.js @@ -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); + } + } +} \ No newline at end of file