|
9 | 9 | [npm-url]: https://npmjs.org/package/fetchff |
10 | 10 | [npm-image]: https://img.shields.io/npm/v/fetchff.svg |
11 | 11 |
|
12 | | -[![NPM version][npm-image]][npm-url] [](https://github.com/MattCCC/fetchff) [](https://github.com/MattCCC/fetchff) [](http://npm-stat.com/charts.html?package=fetchff) [](https://bundlephobia.com/result?p=fetchff) [](https://security.snyk.io/package/npm/fetchff) |
| 12 | +[![NPM version][npm-image]][npm-url] [](https://github.com/MattCCC/fetchff) [](https://github.com/MattCCC/fetchff) [](http://npm-stat.com/charts.html?package=fetchff) [](https://bundlephobia.com/result?p=fetchff) [](https://security.snyk.io/package/npm/fetchff) |
13 | 13 |
|
14 | 14 | </div> |
15 | 15 |
|
@@ -1496,38 +1496,46 @@ function UserComponent({ userId }: { userId: string }) { |
1496 | 1496 |
|
1497 | 1497 | ## Comparison with other libraries |
1498 | 1498 |
|
1499 | | -| Feature | fetchff | ofetch | wretch | axios | native fetch() | |
1500 | | -| -------------------------------------------------- | ----------- | ----------- | ------------ | ------------ | -------------- | |
1501 | | -| **Unified API Client** | ✅ | -- | -- | -- | -- | |
1502 | | -| **Smart Request Cache** | ✅ | -- | -- | -- | -- | |
1503 | | -| **Automatic Request Deduplication** | ✅ | -- | -- | -- | -- | |
1504 | | -| **Revalidation on Window Focus** | ✅ | -- | -- | -- | -- | |
1505 | | -| **Custom Fetching Adapter** | ✅ | -- | -- | -- | -- | |
1506 | | -| **Built-in Error Handling** | ✅ | -- | ✅ | -- | -- | |
1507 | | -| **Customizable Error Handling** | ✅ | -- | ✅ | ✅ | -- | |
1508 | | -| **Retries with exponential backoff** | ✅ | -- | -- | -- | -- | |
1509 | | -| **Advanced Query Params handling** | ✅ | -- | -- | -- | -- | |
1510 | | -| **Custom Retry logic** | ✅ | ✅ | ✅ | -- | -- | |
1511 | | -| **Easy Timeouts** | ✅ | ✅ | ✅ | ✅ | -- | |
1512 | | -| **Polling Functionality** | ✅ | -- | -- | -- | -- | |
1513 | | -| **Easy Cancellation of stale (previous) requests** | ✅ | -- | -- | -- | -- | |
1514 | | -| **Default Responses** | ✅ | -- | -- | -- | -- | |
1515 | | -| **Custom adapters (fetchers)** | ✅ | -- | -- | ✅ | -- | |
1516 | | -| **Global Configuration** | ✅ | -- | ✅ | ✅ | -- | |
1517 | | -| **TypeScript Support** | ✅ | ✅ | ✅ | ✅ | ✅ | |
1518 | | -| **Built-in AbortController Support** | ✅ | -- | -- | -- | -- | |
1519 | | -| **Request Interceptors** | ✅ | ✅ | ✅ | ✅ | -- | |
1520 | | -| **Request and Response Transformation** | ✅ | ✅ | ✅ | ✅ | -- | |
1521 | | -| **Integration with libraries** | ✅ | ✅ | ✅ | ✅ | -- | |
1522 | | -| **Request Queuing** | ✅ | -- | -- | -- | -- | |
1523 | | -| **Multiple Fetching Strategies** | ✅ | -- | -- | -- | -- | |
1524 | | -| **Dynamic URLs** | ✅ | -- | ✅ | -- | -- | |
1525 | | -| **Automatic Retry on Failure** | ✅ | ✅ | -- | ✅ | -- | |
1526 | | -| **Automatically handle 429 Retry-After headers** | ✅ | -- | -- | -- | -- | |
1527 | | -| **Built-in Input Sanitization** | ✅ | -- | -- | -- | -- | |
1528 | | -| **Prototype Pollution Protection** | ✅ | -- | -- | -- | -- | |
1529 | | -| **Server-Side Rendering (SSR) Support** | ✅ | ✅ | -- | -- | -- | |
1530 | | -| **Minimal Installation Size** | 🟢 (4.5 KB) | 🟡 (6.5 KB) | 🟢 (2.21 KB) | 🔴 (13.7 KB) | 🟢 (0 KB) | |
| 1499 | +_fetchff uniquely combines advanced input sanitization, prototype pollution protection, unified cache across React and direct fetches, multiple error handling strategies, and a declarative API repository pattern—all in a single lightweight package._ |
| 1500 | +
|
| 1501 | +| Feature | fetchff | ofetch | wretch | axios | native fetch() | swr | |
| 1502 | +| -------------------------------------------------- | ----------- | ----------- | ------------ | ------------ | -------------- | ----------- | |
| 1503 | +| **Unified API Client** | ✅ | -- | -- | -- | -- | -- | |
| 1504 | +| **Smart Request Cache** | ✅ | -- | -- | -- | -- | ✅ | |
| 1505 | +| **Automatic Request Deduplication** | ✅ | -- | -- | -- | -- | ✅ | |
| 1506 | +| **Revalidation on Window Focus** | ✅ | -- | -- | -- | -- | ✅ | |
| 1507 | +| **Custom Fetching Adapter** | ✅ | -- | -- | -- | -- | ✅ | |
| 1508 | +| **Built-in Error Handling** | ✅ | -- | ✅ | -- | -- | -- | |
| 1509 | +| **Customizable Error Handling** | ✅ | -- | ✅ | ✅ | -- | ✅ | |
| 1510 | +| **Retries with exponential backoff** | ✅ | -- | -- | -- | -- | -- | |
| 1511 | +| **Advanced Query Params handling** | ✅ | -- | -- | -- | -- | -- | |
| 1512 | +| **Custom Response Based Retry logic** | ✅ | ✅ | ✅ | -- | -- | -- | |
| 1513 | +| **Easy Timeouts** | ✅ | ✅ | ✅ | ✅ | -- | -- | |
| 1514 | +| **Conditional Polling Functionality** | ✅ | -- | -- | -- | -- | -- | |
| 1515 | +| **Easy Cancellation of stale (previous) requests** | ✅ | -- | -- | -- | -- | -- | |
| 1516 | +| **Default Responses** | ✅ | -- | -- | -- | -- | ✅ | |
| 1517 | +| **Custom adapters (fetchers)** | ✅ | -- | -- | ✅ | -- | ✅ | |
| 1518 | +| **Global Configuration** | ✅ | -- | ✅ | ✅ | -- | ✅ | |
| 1519 | +| **TypeScript Support** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 1520 | +| **Built-in AbortController Support** | ✅ | -- | -- | -- | -- | -- | |
| 1521 | +| **Request Interceptors** | ✅ | ✅ | ✅ | ✅ | -- | -- | |
| 1522 | +| **Safe deduping + cancellation** | ✅ | -- | -- | -- | -- | -- | |
| 1523 | +| **Response-based polling decisions** | ✅ | -- | -- | -- | -- | -- | |
| 1524 | +| **Request and Response Transformation** | ✅ | ✅ | ✅ | ✅ | -- | -- | |
| 1525 | +| **Integration with libraries** | ✅ | ✅ | ✅ | ✅ | -- | ✅ | |
| 1526 | +| **Request Queuing** | ✅ | -- | -- | -- | -- | -- | |
| 1527 | +| **Multiple Fetching Strategies** | ✅ | -- | -- | -- | -- | -- | |
| 1528 | +| **Dynamic URLs with Path and query separation** | ✅ | -- | ✅ | -- | -- | -- | |
| 1529 | +| **Automatic Retry on Failure** | ✅ | ✅ | -- | ✅ | -- | ✅ | |
| 1530 | +| **Automatically handle 429 Retry-After headers** | ✅ | -- | -- | -- | -- | -- | |
| 1531 | +| **Built-in Input Sanitization** | ✅ | -- | -- | -- | -- | -- | |
| 1532 | +| **Prototype Pollution Protection** | ✅ | -- | -- | -- | -- | -- | |
| 1533 | +| **First Class React Integration** | ✅ | -- | -- | -- | -- | ✅ | |
| 1534 | +| **Shared cache for React and direct fetches** | ✅ | -- | -- | -- | -- | -- | |
| 1535 | +| **Per-endpoint and per-request config merging** | ✅ | -- | -- | -- | -- | -- | |
| 1536 | +| **Declarative API repository pattern** | ✅ | -- | -- | -- | -- | -- | |
| 1537 | +| **Supports Server-Side Rendering (SSR)** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 1538 | +| **Minimal Installation Size** | 🟢 (4.5 KB) | 🟡 (6.5 KB) | 🟢 (2.21 KB) | 🔴 (13.7 KB) | 🟢 (0 KB) | 🟡 (6.2 KB) | |
1531 | 1539 |
|
1532 | 1540 | ## ✏️ Examples |
1533 | 1541 |
|
|
0 commit comments