From 915947e3e7ab7c1fa07596ab4b13bf6e1cc50b76 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Wed, 8 Feb 2023 18:51:39 +0530 Subject: Cleaned code. --- .../webpack/plugins/sanitize-scripts-import-webpack-plugin.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'config/webpack/plugins/sanitize-scripts-import-webpack-plugin.js') diff --git a/config/webpack/plugins/sanitize-scripts-import-webpack-plugin.js b/config/webpack/plugins/sanitize-scripts-import-webpack-plugin.js index 61ce804..37c2cf4 100644 --- a/config/webpack/plugins/sanitize-scripts-import-webpack-plugin.js +++ b/config/webpack/plugins/sanitize-scripts-import-webpack-plugin.js @@ -1,15 +1,13 @@ const { sources } = require("webpack"); -const propectualIndexOf = (string, characterList, start) => { +const perpectualIndexOf = (string, characterList, start) => { if (start > 0) { - let i = 0; let x = start; - while (i < characterList.length) { + for (let i = 0; i < characterList.length; i++) { x = string.indexOf(characterList[i], x + 1); if (x < 0) { return -1; } - i++; } return x; } else { @@ -33,8 +31,8 @@ class SanitizeScriptsImportPlugin { let previouslyEnded = 0; let code = ""; while (true) { - const start = propectualIndexOf(currentAssetContent, ["\n/***/", "\n/***/", "\n"], previouslyEnded + 1); - previouslyEnded = propectualIndexOf(currentAssetContent, ["\n/***/"], start + 1); + const start = perpectualIndexOf(currentAssetContent, ["\n/***/", "\n/***/", "\n"], previouslyEnded + 1); + previouslyEnded = perpectualIndexOf(currentAssetContent, ["\n/***/"], start + 1); if (previouslyEnded < 0) { break; } else { -- cgit v1.2.3