2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00

Added axios.formToJSON method; (#4735)

* Draft

* Added `formDataToJSON` helper;
Added `axios.formToJSON` method;
Added client tests;

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Dmitriy Mozgovoy
2022-05-25 09:21:40 +03:00
committed by GitHub
parent 934f390cc3
commit c008e57fe4
8 changed files with 195 additions and 10 deletions
+37 -1
View File
@@ -441,6 +441,38 @@ var isTypedArray = (function(TypedArray) {
};
})(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
function forEachEntry(obj, fn) {
var generator = obj && obj[Symbol.iterator];
var iterator = generator.call(obj);
var result;
while ((result = iterator.next()) && !result.done) {
var pair = result.value;
fn.call(obj, pair[0], pair[1]);
}
}
function matchAll(regExp, str) {
var matches;
var arr = [];
while ((matches = regExp.exec(str)) !== null) {
arr.push(matches);
}
return arr;
}
var isHTMLForm = kindOfTest('HTMLFormElement');
var hasOwnProperty = (function resolver(_hasOwnProperty) {
return function(obj, prop) {
return _hasOwnProperty.call(obj, prop);
};
})(Object.prototype.hasOwnProperty);
module.exports = {
isArray: isArray,
isArrayBuffer: isArrayBuffer,
@@ -471,5 +503,9 @@ module.exports = {
endsWith: endsWith,
toArray: toArray,
isTypedArray: isTypedArray,
isFileList: isFileList
isFileList: isFileList,
forEachEntry: forEachEntry,
matchAll: matchAll,
isHTMLForm: isHTMLForm,
hasOwnProperty: hasOwnProperty
};