mirror of
https://github.com/DerTyp7/notes-react.git
synced 2025-10-29 20:42:09 +01:00
24 lines
420 B
JavaScript
24 lines
420 B
JavaScript
function secure(text){
|
|
text = text.replace(/'/g, "\\u0027");
|
|
return text;
|
|
}
|
|
|
|
function decode(text){
|
|
text = text.replace(/\\u0027/g, "'");
|
|
return text;
|
|
}
|
|
|
|
function secureId(id){
|
|
id = id.replace(/'/g, "");
|
|
// Regex test if id is a number
|
|
let regexPattern = /^[0-9]*$/;
|
|
if(!regexPattern.test(id)){
|
|
return "";
|
|
}
|
|
|
|
return id;
|
|
}
|
|
|
|
module.exports = {
|
|
secure, decode, secureId
|
|
} |