Skip to content

Cleanup & allow passing fetch function - #19

Open
jdachtera wants to merge 4 commits into
appit-online:masterfrom
jdachtera:cleanup
Open

Cleanup & allow passing fetch function#19
jdachtera wants to merge 4 commits into
appit-online:masterfrom
jdachtera:cleanup

Conversation

@jdachtera

Copy link
Copy Markdown

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

Comment thread tsconfig.json
{
"compilerOptions": {
"target": "es5",
"target": "es2021",

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deadlinecode

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants