- WIP: implement data pre-processor for #101

- implement checks for #101
- add some specs
This commit is contained in:
Sefa Ilkimen
2019-11-10 06:40:31 +01:00
parent cc3e70771c
commit 867b8ea202
7 changed files with 191 additions and 24 deletions
+22
View File
@@ -0,0 +1,22 @@
module.exports = function init(FormData, console, messages) {
var interface = {
checkFormDataApi: checkFormDataApi,
logWarnings: logWarnings,
};
return interface;
function logWarnings() {
if (!FormData) {
console.warn(messages.MISSING_FORMDATA_API);
} else if (!FormData.prototype || !FormData.prototype.entries) {
console.warn(messages.MISSING_FORMDATA_ENTRIES_API);
}
}
function checkFormDataApi() {
if (!FormData || !FormData.prototype || !FormData.prototype.entries) {
throw new Error(messages.MISSING_FORMDATA_ENTRIES_API);
}
}
};