axios-case-converter
Version:
Axios transformer/interceptor that converts snake_case/camelCase
32 lines (22 loc) • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isTransformable = exports.isPlainObject = exports.isFormData = exports.isURLSearchParams = void 0;
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var isURLSearchParams = function isURLSearchParams(value) {
return typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams;
};
exports.isURLSearchParams = isURLSearchParams;
var isFormData = function isFormData(value) {
return typeof FormData !== "undefined" && value instanceof FormData;
};
exports.isFormData = isFormData;
var isPlainObject = function isPlainObject(value) {
return _typeof(value) === "object" && value !== null && Object.prototype.toString.call(value) === "[object Object]";
};
exports.isPlainObject = isPlainObject;
var isTransformable = function isTransformable(value) {
return Array.isArray(value) || isPlainObject(value) || isFormData(value) || isURLSearchParams(value);
};
exports.isTransformable = isTransformable;