full site update
This commit is contained in:
36
node_modules/cross-fetch/README.md
generated
vendored
36
node_modules/cross-fetch/README.md
generated
vendored
@@ -6,32 +6,26 @@ cross-fetch<br>
|
||||
[](https://codecov.io/gh/lquixada/cross-fetch)
|
||||
================
|
||||
|
||||
Universal WHATWG Fetch API for Node, Browsers, Workers and React Native. The scenario that cross-fetch really shines is when the same JavaScript codebase needs to run on different platforms.
|
||||
Universal WHATWG Fetch API for Node, Browsers and React Native. The scenario that cross-fetch really shines is when the same JavaScript codebase needs to run on different platforms.
|
||||
|
||||
- **Platform agnostic**: browsers, Node or React Native
|
||||
- **Optional polyfill**: it's up to you if something is going to be added to the global object or not
|
||||
- **Simple interface**: no instantiation, no configuration and no extra dependency
|
||||
- **WHATWG compliant**: it works the same way wherever your code runs
|
||||
- **TypeScript support**: better development experience with types.
|
||||
- **Worker support**: works on different types of workers such as Service Workers and CloudFlare Workers
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Table of Contents](#table-of-contents)
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [Demo \& API](#demo--api)
|
||||
- [FAQ](#faq)
|
||||
- [Yet another fetch library?](#yet-another-fetch-library)
|
||||
- [Why polyfill might not be a good idea?](#why-polyfill-might-not-be-a-good-idea)
|
||||
- [How does cross-fetch work?](#how-does-cross-fetch-work)
|
||||
- [Who's Using It?](#whos-using-it)
|
||||
- [Thanks](#thanks)
|
||||
- [License](#license)
|
||||
- [Author](#author)
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [Demo & API](#demo--api)
|
||||
- [FAQ](#faq)
|
||||
- [Thanks](#thanks)
|
||||
- [License](#license)
|
||||
- [Author](#author)
|
||||
|
||||
* * *
|
||||
|
||||
@@ -41,7 +35,7 @@ Universal WHATWG Fetch API for Node, Browsers, Workers and React Native. The sce
|
||||
npm install --save cross-fetch
|
||||
```
|
||||
|
||||
As a [ponyfill](https://github.com/sindresorhus/ponyfill) (imports locally):
|
||||
As a [ponyfill](https://github.com/sindresorhus/ponyfill):
|
||||
|
||||
```javascript
|
||||
// Using ES6 modules with Babel or TypeScript
|
||||
@@ -51,7 +45,7 @@ import fetch from 'cross-fetch';
|
||||
const fetch = require('cross-fetch');
|
||||
```
|
||||
|
||||
As a polyfill (installs globally):
|
||||
As a polyfill:
|
||||
|
||||
```javascript
|
||||
// Using ES6 modules
|
||||
@@ -119,6 +113,9 @@ import fetch from 'cross-fetch';
|
||||
})();
|
||||
```
|
||||
|
||||
> ⚠️ **Warning**: If you're in an environment that doesn't support Promises such as Internet Explorer, you must install an ES6 Promise compatible polyfill. [es6-promise](https://github.com/jakearchibald/es6-promise) is suggested.
|
||||
|
||||
|
||||
## Demo & API
|
||||
|
||||
You can find a comprehensive doc at [Github's fetch](https://github.github.io/fetch/) page. If you want to play with cross-fetch, check our [**JSFiddle playground**](https://jsfiddle.net/lquixada/3ypqgacp/).
|
||||
@@ -132,10 +129,17 @@ You can find a comprehensive doc at [Github's fetch](https://github.github.io/fe
|
||||
|
||||
I did a lot of research in order to find a fetch library that could be simple, cross-platform and provide polyfill as an option. There's a plethora of libs out there but none could match those requirements.
|
||||
|
||||
|
||||
#### Why not isomorphic-fetch?
|
||||
|
||||
My preferred library used to be [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) but it has this [bug](https://github.com/matthew-andrews/isomorphic-fetch/issues/125) that prevents it from running in a react native environment. It seems unlikely to be fixed since there haven't been any new commits to it since 2016. That means dependencies are outdated as well.
|
||||
|
||||
|
||||
#### Why polyfill might not be a good idea?
|
||||
|
||||
In a word? Risk. If the spec changes in the future, it might be problematic to debug. Read more about it on [sindresorhus's ponyfill](https://github.com/sindresorhus/ponyfill#how-are-ponyfills-better-than-polyfills) page. It's up to you if you're fine with it or not.
|
||||
|
||||
|
||||
#### How does cross-fetch work?
|
||||
|
||||
Just like isomorphic-fetch, it is just a proxy. If you're in node, it delivers you the [node-fetch](https://github.com/bitinn/node-fetch/) library, if you're in a browser or React Native, it delivers you the github's [whatwg-fetch](https://github.com/github/fetch/). The same strategy applies whether you're using polyfill or ponyfill.
|
||||
|
Reference in New Issue
Block a user