From 1c944e9ae187f3c86f192eea56b64e8e7559de21 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 24 Apr 2023 10:46:10 +0100 Subject: [PATCH] Remove dependency: string-sanitizer-fix & npm update Signed-off-by: Fred Boniface --- package-lock.json | 5 ----- src/utils/sanitizer.utils.js | 12 +++++++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index a9f6232..2d230bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/src/utils/sanitizer.utils.js b/src/utils/sanitizer.utils.js index 245b1ee..ea238bf 100644 --- a/src/utils/sanitizer.utils.js +++ b/src/utils/sanitizer.utils.js @@ -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 @@ -7,8 +7,12 @@ function removeNonAlphanumeric(inputString) { // Should be able to replace sani function removeNonAlpha(inputString) { // Should be able to replace sanitizer module 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

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, } \ No newline at end of file