MCPcopy Create free account
hub / github.com/ampproject/amphtml / chkIsvalidContext

Function chkIsvalidContext

ads/vendors/affinity.js:39–51  ·  view source on GitHub ↗
(mixContext)

Source from the content-addressed store, hash-verified

37 return '[object Object]' == O2s.call(val);
38 },
39 chkIsvalidContext = function (mixContext) {
40 if ('string' == typeof mixContext) {
41 try {
42 mixContext = JSON.parse(mixContext);
43 } catch (e) {
44 return false;
45 }
46 }
47 if (isObject(mixContext) && mixContext.sourceUrl) {
48 return true;
49 }
50 return false;
51 },
52 getAmpContext = function () {
53 if (chkIsvalidContext(W.context)) {
54 return W.context;

Callers 1

getAmpContextFunction · 0.85

Calls 2

isObjectFunction · 0.70
parseMethod · 0.45

Tested by

no test coverage detected