2023-05-06 21:54:49 +01:00
|
|
|
//const log = require('../utils/log.utils');
|
2023-02-09 20:34:53 +00:00
|
|
|
|
2023-05-06 21:54:49 +01:00
|
|
|
function removeNonAlphanumeric(inputString) { // Should be able to replace sanitizer module
|
|
|
|
return inputString.replace(/[^a-zA-Z0-9]/g, '');
|
|
|
|
}
|
2023-02-09 20:34:53 +00:00
|
|
|
|
2023-05-06 21:54:49 +01:00
|
|
|
function removeNonAlpha(inputString) { // Should be able to replace sanitizer module
|
|
|
|
return inputString.replace(/[^a-zA-Z]/g, '');
|
2023-02-09 20:34:53 +00:00
|
|
|
}
|
|
|
|
|
2023-05-24 20:42:32 +01:00
|
|
|
function removeNonNumeric(inputString) {
|
|
|
|
return inputString.replace(/[^0-9]/g, '');
|
|
|
|
}
|
|
|
|
|
2023-05-06 21:54:49 +01:00
|
|
|
const cleanApiEndpointTxt = removeNonAlpha;
|
|
|
|
const cleanApiEndpointNum = removeNonAlphanumeric;
|
|
|
|
|
|
|
|
function cleanNrcc(input) { // Remove newlines and then <p> tags from input
|
|
|
|
const cleanInput = input.replace(/[\n\r]/g, '').replace(/<\/?p[^>]*>/g, '');
|
|
|
|
return cleanInput;
|
2023-02-09 20:34:53 +00:00
|
|
|
}
|
|
|
|
|
2023-05-06 21:54:49 +01:00
|
|
|
async function getDomainFromEmail(mail) { // Needs testing
|
|
|
|
let split = mail.split('@');
|
|
|
|
return split[1];
|
2023-02-09 20:34:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2023-05-06 21:54:49 +01:00
|
|
|
cleanApiEndpointTxt,
|
|
|
|
cleanApiEndpointNum,
|
|
|
|
removeNonAlpha,
|
|
|
|
removeNonAlphanumeric,
|
2023-05-24 20:42:32 +01:00
|
|
|
removeNonNumeric,
|
2023-05-06 21:54:49 +01:00
|
|
|
cleanNrcc,
|
|
|
|
getDomainFromEmail,
|
|
|
|
};
|