@sapphire/fetch 3.0.0 → 3.0.1-next.0c8d0135.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +7 -6
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -28,16 +28,16 @@
28
28
 
29
29
  ## Description
30
30
 
31
- Node has a great global `fetch` (powered by [undici]) for making API calls, but because it focuses solely on bringing the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to Node.js, it doesn't provide specific error messages and handling for different return types (JSON, Buffer, plain text, etc). This is where `@sapphire/fetch` comes in. The syntax is more restrictive than that of [undici], but that makes it consistent and easier to use in TypeScript.
31
+ Node has a great global `fetch` (powered by [undici]) for making API calls, but because it focuses solely on bringing the [Fetch API][fetch-mdn] to Node.js, it doesn't provide specific error messages and handling for different return types (JSON, Buffer, plain text, etc). This is where `@sapphire/fetch` comes in. The syntax is more restrictive than that of [undici], but that makes it consistent and easier to use in TypeScript.
32
32
 
33
33
  ## Features
34
34
 
35
35
  - Written in TypeScript
36
36
  - Fully tested
37
- - Exported `enum` for the common return data types.
38
- - Throws distinctive errors when the API returns a "not ok" status code to make them easier to understand.
39
- - Enforces casting the return type when requesting JSON data, to ensure your return data is strictly typed.
40
- - Uses global `fetch`, which for NodeJS is [undici] and for browsers is the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
37
+ - Exported `enum` for the common return data types
38
+ - Throws distinctive errors when the API returns a "not ok" status code to make them easier to understand
39
+ - Enforces casting the return type when requesting JSON data, to ensure your return data is strictly typed
40
+ - Uses global `fetch`, which for NodeJS is [undici] and for browsers is the [Fetch API][fetch-mdn]
41
41
 
42
42
  ## Installation
43
43
 
@@ -92,7 +92,7 @@ console.log(sapphireLogo);
92
92
  // Import the fetch function
93
93
  import { fetch, FetchResultTypes, FetchMethods } from '@sapphire/fetch';
94
94
 
95
- // Fetch the data. No need to call `.json()` after making the request!
95
+ // Post the data. No need to call `.json()` after making the request!
96
96
  const responseData = await fetch(
97
97
  'https://jsonplaceholder.typicode.com/todos',
98
98
  {
@@ -140,4 +140,5 @@ Thank you to all the people who already contributed to Sapphire!
140
140
 
141
141
  <!-- LINKS -->
142
142
 
143
+ [fetch-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
143
144
  [undici]: https://github.com/nodejs/undici
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire/fetch",
3
- "version": "3.0.0",
3
+ "version": "3.0.1-next.0c8d0135.0",
4
4
  "description": "Tiny wrapper around globalThis.fetch for improved TypeScript and data type support",
5
5
  "author": "@sapphire",
6
6
  "license": "MIT",