@embrace-io/react-native
Version:
A React Native wrapper for the Embrace SDK
23 lines (22 loc) • 669 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateAxiosInterface = void 0;
/**
* This method validates if the instance provided has the same structure
* as Axios
*/
const validateAxiosInterface = (instance) => {
if (!("interceptors" in instance)) {
return false;
}
const { interceptors } = instance;
if (!("request" in interceptors && "response" in interceptors)) {
return false;
}
const { request, response } = interceptors;
if (!("use" in request && "use" in response)) {
return false;
}
return true;
};
exports.validateAxiosInterface = validateAxiosInterface;