MCPcopy Create free account
hub / github.com/TruthHun/BookStack / tryConvertToPromise

Function tryConvertToPromise

static/word2md/mammoth.browser.js:8788–8813  ·  view source on GitHub ↗
(obj, context)

Source from the content-addressed store, hash-verified

8786var isObject = util.isObject;
8787
8788function tryConvertToPromise(obj, context) {
8789 if (isObject(obj)) {
8790 if (obj instanceof Promise) return obj;
8791 var then = getThen(obj);
8792 if (then === errorObj) {
8793 if (context) context._pushContext();
8794 var ret = Promise.reject(then.e);
8795 if (context) context._popContext();
8796 return ret;
8797 } else if (typeof then === "function") {
8798 if (isAnyBluebirdPromise(obj)) {
8799 var ret = new Promise(INTERNAL);
8800 obj._then(
8801 ret._fulfill,
8802 ret._reject,
8803 undefined,
8804 ret,
8805 null
8806 );
8807 return ret;
8808 }
8809 return doThenable(obj, then, context);
8810 }
8811 }
8812 return obj;
8813}
8814
8815function doGetThen(obj) {
8816 return obj.then;

Callers 8

mammoth.browser.jsFile · 0.70
finallyHandlerFunction · 0.70
promiseFromYieldHandlerFunction · 0.70
propsFunction · 0.70
raceFunction · 0.70
gotAccumFunction · 0.70
castPreservingDisposableFunction · 0.70
iteratorFunction · 0.70

Calls 4

isObjectFunction · 0.70
getThenFunction · 0.70
isAnyBluebirdPromiseFunction · 0.70
doThenableFunction · 0.70

Tested by

no test coverage detected