Browse Source

FIX,REFA: handling parameter given as string or function

dev-feat-component_preview
chris 2 months ago
parent
commit
46f12f517d
  1. 18
      src/base/extStore.js

18
src/base/extStore.js

@ -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}; `;
}
}

Loading…
Cancel
Save