Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
contentGroups.forEach(contentGroup => {
const pageGroups = getScriptGroupValues(contentGroup as ClientScript[], (s: ClientScript) => s.page.toString());
if (pageGroups.length === 1 && RequestFilterRule.isANY((pageGroups[0][0] as ClientScript).page)) { /*eslint-disable-line no-extra-parens*/
duplicatedScripts.push(pageGroups[0][0] as ClientScript);
return;
}
const forAllPagesGroup = pageGroups.find(pg => RequestFilterRule.isANY((pg[0] as ClientScript).page)); /*eslint-disable-line no-extra-parens*/
if (forAllPagesGroup) {
pageGroups
.filter(pg => !RequestFilterRule.isANY((pg[0] as ClientScript).page)) /*eslint-disable-line no-extra-parens*/
.forEach(pg => {
duplicatedScripts.push(pg[0] as ClientScript);
});
}
else {
pageGroups
.filter(pg => !RequestFilterRule.isANY((pg[0] as ClientScript).page)) /*eslint-disable-line no-extra-parens*/
.forEach(pg => {
const forAllPagesGroup = pageGroups.find(pg => RequestFilterRule.isANY((pg[0] as ClientScript).page)); /*eslint-disable-line no-extra-parens*/