|
|
@ -68,17 +68,21 @@ function clearFunctionDeclarationText(func) { |
|
|
|
* @returns {string} |
|
|
|
*/ |
|
|
|
function getScriptTagInjectionText(func, registrationName) { |
|
|
|
let funcHasName = func.name && func.name.trim() !== ''; |
|
|
|
if (func.startWith('function')) { |
|
|
|
let label = `function ${registrationName}`; |
|
|
|
let isNameInFuncText = func.startWith(label); |
|
|
|
if (funcHasName && isNameInFuncText) { |
|
|
|
let funcHasName; |
|
|
|
if (typeof func === 'function') { |
|
|
|
funcHasName = ((func.name) && func.name.trim() !== ''); |
|
|
|
} |
|
|
|
|
|
|
|
if (func.startsWith('function')) { |
|
|
|
let label = ` function ${registrationName}`; |
|
|
|
let isNameInFuncText = func.startsWith(label); |
|
|
|
if (isNameInFuncText) { |
|
|
|
return func; |
|
|
|
} else { |
|
|
|
return [label, '(', func.split('(', 1)[1]].join('') |
|
|
|
return [label, '(', func.split('(').slice(1).join('(')].join('') |
|
|
|
} |
|
|
|
} else { |
|
|
|
return `const ${registrationName} = ${func}; `; |
|
|
|
return ` const ${registrationName} = ${func}; `; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|