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

Function doThenable

static/word2md/mammoth.browser.js:8837–8864  ·  view source on GitHub ↗
(x, then, context)

Source from the content-addressed store, hash-verified

8835}
8836
8837function doThenable(x, then, context) {
8838 var promise = new Promise(INTERNAL);
8839 var ret = promise;
8840 if (context) context._pushContext();
8841 promise._captureStackTrace();
8842 if (context) context._popContext();
8843 var synchronous = true;
8844 var result = util.tryCatch(then).call(x, resolve, reject);
8845 synchronous = false;
8846
8847 if (promise && result === errorObj) {
8848 promise._rejectCallback(result.e, true, true);
8849 promise = null;
8850 }
8851
8852 function resolve(value) {
8853 if (!promise) return;
8854 promise._resolveCallback(value);
8855 promise = null;
8856 }
8857
8858 function reject(reason) {
8859 if (!promise) return;
8860 promise._rejectCallback(reason, synchronous, true);
8861 promise = null;
8862 }
8863 return ret;
8864}
8865
8866return tryConvertToPromise;
8867};

Callers 1

tryConvertToPromiseFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected