A utility library for Axios that provides a declarative way to add request/response/error transforms to Axios instances. Version 0.4.15 (latest) is stable with infrequent releases. It allows defining matchers based on URL patterns and HTTP methods to apply custom transformation functions to request data, response data, and error handling, including retry logic. Ships TypeScript types. Differentiates from plain interceptors by offering a pattern-based configuration approach.
npm install axios-add-transformsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a Transforms instance with a matcher that modifies request data for URLs matching /^\/users\/?$/, applying the transform to an Axios instance, and making a request.
Use anchored regex patterns (e.g., /^\/users\/?$/) to avoid matching substrings.
Replace `transforms.addInterceptors(axiosInstance)` with `transforms.applyTransform(axiosInstance)`.
Ensure the factory returns a stable object to avoid recreation of context resources.
Update to use `new Transforms()` constructor. For older code, import the class constructor and instantiate.
Use the correct import for v0.4.0+: `import Transforms from 'axios-add-transforms'` and then `new Transforms({...})`.Ensure `node_modules` types are included in tsconfig.json (`"types": ["node", "axios-add-transforms"]`) and that `esModuleInterop` is enabled.