MCPcopy
hub / github.com/ashutosh1919/masterPortfolio / handleThenable

Function handleThenable

src/assets/font-awesome/js/all.js:11692–11742  ·  view source on GitHub ↗
(promise, value)

Source from the content-addressed store, hash-verified

11690 }
11691
11692 function handleThenable(promise, value) {
11693 var resolved;
11694
11695 try {
11696 if (promise === value) {
11697 throw new TypeError(
11698 "A promises callback cannot return that same promise."
11699 );
11700 }
11701
11702 if (
11703 value &&
11704 (typeof value === "function" || _typeof(value) === "object")
11705 ) {
11706 // then should be retrieved only once
11707 var then = value.then;
11708
11709 if (typeof then === "function") {
11710 then.call(
11711 value,
11712 function (val) {
11713 if (!resolved) {
11714 resolved = true;
11715
11716 if (value === val) {
11717 fulfill(promise, val);
11718 } else {
11719 resolve(promise, val);
11720 }
11721 }
11722 },
11723 function (reason) {
11724 if (!resolved) {
11725 resolved = true;
11726 reject(promise, reason);
11727 }
11728 }
11729 );
11730 return true;
11731 }
11732 }
11733 } catch (e) {
11734 if (!resolved) {
11735 reject(promise, e);
11736 }
11737
11738 return true;
11739 }
11740
11741 return false;
11742 }
11743
11744 function resolve(promise, value) {
11745 if (promise === value || !handleThenable(promise, value)) {

Callers 2

invokeCallbackFunction · 0.70
resolveFunction · 0.70

Calls 4

_typeofFunction · 0.70
fulfillFunction · 0.70
resolveFunction · 0.70
rejectFunction · 0.70

Tested by

no test coverage detected