app.mixin(
{
methods: {
formatPhoneNumber(str) {
let cleaned = ('' + str).replace(/\D/g, '');
let match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/);
if (match) {
return '(' + match[1] + ') ' + match[2] + '-' + match[3]
};
return "";
},
convertJsonToCfFormScope(jsonObject) {
var returnBody = ''
var keyList = ''
for (const key in jsonObject) {
returnBody = returnBody + key + '=' + encodeURIComponent(jsonObject[key]) + '&'
};
for (const key in jsonObject) {
keyList = keyList + key + ','
};
returnBody = returnBody + 'jsonObject=' + encodeURIComponent(JSON.stringify(jsonObject)) + '&keyList=' + keyList + 'jsonObject';
return returnBody
}
}
}
)