There is a big javascript library (~ 40 000 lines of code) and an application which uses less than 50% of the library's code.
There is a test which utilizes all the needed functionality from the library and can produce coverage report.
How to remove programmatically every unused line of code relying on the test?
Note: coverage report contains indices of lines which were executed but it is not accurate: closing braces are ignored, lines with method names are marked as executed even if the method body was not etc.