0

My Problem

I have multiple JS scripts that are very large. Each script is for a different page of a 10 page website. Each script contains about 90% of the same code, but the 10% is page specific. The code is jumbled up and about so it's not as easy as just removing a-b-c.

My Question

Is there a software or method to remove the duplicate code from scripts, js or other, without removing unique code?

4
  • Although I am sure there is, you could start by splitting up your code into more logical modules. From there you can continue subdividing the code as to it's functionality. It will give you a chance to get re-acquainted with your code and to separate the good from the bad. Also, do you really want to leave up to an algorithm, that might simply decide on how to divide your code? Commented Nov 27, 2017 at 8:38
  • @Icepickle the code is some 40k+ lines it would take me a while else i would have done it, its also not my code Commented Nov 27, 2017 at 8:39
  • Wow, any chance you could speak with the original implementer? It seems very old school to have such a huge single file? Maybe he originally used some kind of build tool that didn't get documented? Commented Nov 27, 2017 at 8:42
  • May be this will help: stackoverflow.com/questions/2627081/… Commented Nov 27, 2017 at 8:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.