Remove dependency: string-sanitizer-fix & npm update

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-04-24 10:46:10 +01:00
parent 49bb0627e9
commit 1c944e9ae1
2 changed files with 9 additions and 8 deletions

5
package-lock.json generated
View File

@ -2121,11 +2121,6 @@
"node": ">= 0.8"
}
},
"node_modules/string-sanitizer-fix": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/string-sanitizer-fix/-/string-sanitizer-fix-2.0.1.tgz",
"integrity": "sha512-I5RSqL5vDfKnoAbpFP2mU0QAh7Gc1KoeIg02N+5+NBfDB/MiSddgNNXfmWND7+BBwy3zub6s/ZWRbZICZKUA0g=="
},
"node_modules/strnum": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz",

View File

@ -1,4 +1,4 @@
const clean = require('string-sanitizer-fix');
//const clean = require('string-sanitizer-fix');
const log = require('../utils/log.utils');
function removeNonAlphanumeric(inputString) { // Should be able to replace sanitizer module
@ -9,6 +9,10 @@ function removeNonAlpha(inputString) { // Should be able to replace sanitizer m
return inputString.replace(/[^a-zA-Z]/g, '');
}
const cleanApiEndpointTxt = removeNonAlpha
const cleanApiEndpointNum = removeNonAlphanumeric
/*
function cleanApiEndpointTxt(input) {
var output = clean.sanitize.keepSpace(input)
if (output != input){
@ -24,7 +28,7 @@ function cleanApiEndpointNum(input) {
}
return output
}
*/
function cleanNrcc(input) { // Remove newlines and then <p> tags from input
const cleanInput = input.replace(/[\n\r]/g, '').replace(/<\/?p[^>]*>/g, '');
return cleanInput;
@ -38,6 +42,8 @@ async function getDomainFromEmail(mail) { // Needs testing
module.exports = {
cleanApiEndpointTxt,
cleanApiEndpointNum,
removeNonAlpha,
removeNonAlphanumeric,
cleanNrcc,
getDomainFromEmail,
}