youtube-search icon indicating copy to clipboard operation
youtube-search copied to clipboard

Cleanup & allow passing fetch function

Open jdachtera opened this issue 2 years ago • 1 comments

Hey @david7117,

thanks for making this useful library.

I worked a bit on cleaning up the code and removing the need for any types. Also I added a first jest test.

A probably controversial (and breaking) change is that I removed the dependency to the got library and instead allowed to pass your own version fetch function. This makes testing easier and also allows using the library in the browser (e.g. electron) or other environments which are not supported by got.

To get back the got features (caching, following redirects, etc) one could easily use https://www.npmjs.com/package/got-fetch and pass it as an option. This makes the library more flexible but also is a breaking change.

I would be happy to read your thoughts about this.

Jascha

jdachtera avatar Mar 28 '22 12:03 jdachtera

First of all i really need this I am working with tauri where i don't even have a node js "backend" like in electron so browser support would be very important for me

Second There is no need to change the compilerOptions for just using replaceAll Just use /YourText/g with replace as a regular expression

deadlinecode avatar Dec 02 '22 16:12 deadlinecode