mirror of
https://github.com/DerTyp7/notes-react.git
synced 2025-10-30 21:07:10 +01:00
added secure id
This commit is contained in:
@@ -8,6 +8,17 @@ function decode(text){
|
||||
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
|
||||
secure, decode, secureId
|
||||
}
|
||||
Reference in New Issue
Block a user