I found a portion of some open source code I want to reuse in my project. The code I want does not have an API, so I plan to copy and pasted into my project and modify it appropriately. The thing is, I don't know if that'll be feasible: the size of the code I want is too difficult to reason about at a glance.
In my mind, the biggest risk is the code I want will depend on all the code I don't want. If that were the case, it's probably not worth trying to extract the code. Unfortunately the code is JavaScript without a module system and that makes it hard for me to reason about this risk. If it were written in typescript, the import statements at the top of the file would tell me the dependencies.
Here's my question: what's the best way to learn the dependencies of the files I want to use? I don't want to poison the well, but I was thinking I could extract them into their own typescript project and see what errors pop up re: unknown functions/variables. Is there a better way to go about this?