fetchres provides response handler utilities for the Fetch API, simplifying common patterns like parsing JSON and handling errors. Version 1.7.2 is current; no recent releases. It does not bundle its own fetch or Promise polyfills, so users must supply them (e.g., for older browsers or Node.js). Key differentiator: it exposes custom error types (BadServerResponseError, InvalidJsonError) for fine-grained error handling versus the native Response object.
npm install fetchresNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates using fetchres.json to parse a JSON response and handle specific error types.
Install a fetch polyfill (e.g., 'whatwg-fetch') and Promise polyfill (e.g., 'es6-promise') and import them before fetchres.
Always pass the result of fetch() (a Response object) to fetchres methods.
Consider wrapping with type annotations or migrating to a typed alternative (e.g., ky).
Use default import: import fetchres from 'fetchres' then fetchres.json, or require: const fetchres = require('fetchres').Chain fetch with .then(response => fetchres.json(response)) or use .then(fetchres.json) on the fetch promise.
No dependency data recorded yet.