UNPKG

guardz-axios

Version:

Type-safe HTTP client built on top of Axios with runtime validation using guardz. Part of the guardz ecosystem for comprehensive TypeScript type safety.

19 lines 625 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.safeGet = safeGet; const executeRequest_1 = require("../internal/executeRequest"); /** * Pattern 1: Curried Function (Google/Ramda style) * Usage: const getUserSafely = safeGet({ guard: isUser, onTypeMismatch: ... }); * const result = await getUserSafely('/users/1'); */ function safeGet(config) { return async (url, axiosConfig) => { return (0, executeRequest_1.executeRequest)({ ...axiosConfig, url, method: "GET", }, config); }; } //# sourceMappingURL=safeGet.js.map