newStaffLDB-API #48
11
package-lock.json
generated
11
package-lock.json
generated
@ -28,7 +28,6 @@
|
||||
"devDependencies": {
|
||||
"@owlboard/ts-types": "^0.0.9",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/pino": "^7.0.5",
|
||||
"eslint": "^8.39.0",
|
||||
"jest": "^29.6.2",
|
||||
"prettier": "^2.8.8",
|
||||
@ -2687,16 +2686,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.2.tgz",
|
||||
"integrity": "sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw=="
|
||||
},
|
||||
"node_modules/@types/pino": {
|
||||
"version": "7.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/pino/-/pino-7.0.5.tgz",
|
||||
"integrity": "sha512-wKoab31pknvILkxAF8ss+v9iNyhw5Iu/0jLtRkUD74cNfOOLJNnqfFKAv0r7wVaTQxRZtWrMpGfShwwBjOcgcg==",
|
||||
"deprecated": "This is a stub types definition. pino provides its own type definitions, so you do not need this installed.",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"pino": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/stack-utils": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz",
|
||||
|
@ -35,7 +35,6 @@
|
||||
"devDependencies": {
|
||||
"@owlboard/ts-types": "^0.0.9",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/pino": "^7.0.5",
|
||||
"eslint": "^8.39.0",
|
||||
"jest": "^29.6.2",
|
||||
"prettier": "^2.8.8",
|
||||
|
@ -1,7 +1,11 @@
|
||||
import { logger } from "./logger.utils";
|
||||
|
||||
const htmlShrink = require("html-minifier").minify;
|
||||
const juice = require("juice");
|
||||
|
||||
// Inlines styles and minifies the inlined HTML
|
||||
async function minifyMail(input: string): Promise<string> {
|
||||
logger.trace("minifyMail: Minifying mail output")
|
||||
const inlined: string = juice(input);
|
||||
return htmlShrink(inlined, {
|
||||
removeComments: true,
|
||||
|
@ -1,4 +1,7 @@
|
||||
import { logger } from "./logger.utils";
|
||||
|
||||
export function removeNewlineAndPTag(input: string): string {
|
||||
logger.debug("removeNewlineAndPTag: Cleaning string")
|
||||
const regex = /[\n\r]|<\/?p[^>]*>/g;
|
||||
return input.replace(regex, function (match) {
|
||||
if (match === "\n" || match === "\r") {
|
||||
|
@ -1,14 +1,19 @@
|
||||
//const log = require('../utils/log.utils');
|
||||
|
||||
import { logger } from "./logger.utils";
|
||||
|
||||
function removeNonAlphanumeric(inputString: string) {
|
||||
logger.debug("removeNonAlphanumeric: Sanitizing string")
|
||||
return inputString.replace(/[^a-zA-Z0-9]/g, "");
|
||||
}
|
||||
|
||||
function removeNonAlpha(inputString: string) {
|
||||
logger.debug("removeNonAlpha: Sanitizing string")
|
||||
return inputString.replace(/[^a-zA-Z]/g, "");
|
||||
}
|
||||
|
||||
function removeNonNumeric(inputString: string) {
|
||||
logger.debug("removeNonNumeric: Sanitizing string")
|
||||
return inputString.replace(/[^0-9]/g, "");
|
||||
}
|
||||
|
||||
@ -16,12 +21,14 @@ const cleanApiEndpointTxt = removeNonAlpha;
|
||||
const cleanApiEndpointNum = removeNonAlphanumeric;
|
||||
|
||||
function cleanNrcc(input: string) {
|
||||
logger.error("DEPRECATED FUNCTION","cleanNrcc: Converting NRCC Data")
|
||||
// Remove newlines and then <p> tags from input
|
||||
const cleanInput = input.replace(/[\n\r]/g, "").replace(/<\/?p[^>]*>/g, "");
|
||||
return cleanInput;
|
||||
}
|
||||
|
||||
function getDomainFromEmail(mail: string) {
|
||||
logger.debug("getDomainFromEmail: Obtaining domain from email address")
|
||||
// Needs testing
|
||||
let split = mail.split("@");
|
||||
return split[1].toLowerCase();
|
||||
|
@ -1,10 +1,14 @@
|
||||
function unixLocal(unix: number) {
|
||||
import { logger } from "./logger.utils";
|
||||
|
||||
function unixLocal(unix: number): string {
|
||||
logger.trace(`unixLocal: Converting time: ${unix}`)
|
||||
var jsTime = unix * 1000;
|
||||
var dt = new Date(jsTime);
|
||||
return dt.toLocaleString();
|
||||
}
|
||||
|
||||
function jsUnix(js: number) {
|
||||
function jsUnix(js: number): number {
|
||||
logger.trace(`jsUnix: Converting time: ${js}`)
|
||||
return Math.floor(js / 1000);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user