verdnatura-chat/app/lib/database/utils.ts

8 lines
299 B
TypeScript
Raw Normal View History

2022-02-28 18:00:47 +00:00
import XRegExp from 'xregexp';
// Matches letters from any alphabet and numbers
const likeStringRegex = XRegExp('[^\\p{L}\\p{Nd}]', 'g');
export const sanitizeLikeString = (str?: string): string | undefined => str?.replace(likeStringRegex, '_');
export const sanitizer = (r: object): object => r;