convertParameters too complicated
It can be made way easier than what it is now, not sure why I have it the way it is now, maybe I had plans for non MV parameter type conversion but considering this is library for MV, it's best to simply use the easier method.
Thanks to wayne65 for sparking the conversation and letting me know it converts all types as well.
const parseParameters = function (params) {
let obj
const isObject = () => params && typeof params === 'object'
try {
obj = JSON.parse(isObject() ? JSON.stringify(params) : params)
} catch (e) {
throw new Error(e)
}
if (isObject()) {
Object.keys(obj).forEach(key => {
obj[key] = parseParameters(obj[key])
if (obj[key] === '') {
obj[key] = null
}
})
}
return obj
}
Edited by ltngames