Unnecessary escape characters in cookie.js

Removed unnecessary escape characters from regex in "getCookie function in cookie.js" - 
. ( ) [ / +
The above characters don't need escaping.
This commit is contained in:
Rohan Rawat 2021-06-18 01:54:25 +05:30 committed by GitHub
parent 9680c673a3
commit cd466c514a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
function getCookie(name) {
let matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
"(?:^|; )" + name.replace(/([.$?*|{}()[\]\\/+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
}