Skip to content

Instantly share code, notes, and snippets.

@emilhein
Created March 25, 2022 12:36
Show Gist options
  • Save emilhein/b5503166892828a6065052011303a5f6 to your computer and use it in GitHub Desktop.
Save emilhein/b5503166892828a6065052011303a5f6 to your computer and use it in GitHub Desktop.
const getParameterByName = function (name) {
const regexS = "[\\?&]" + name + "=([^&#]*)";
const regex = new RegExp(regexS);
const results = regex.exec(window.location.search);
if (results === null) {
return "";
}
return decodeURIComponent(results[1].replace(/\+/g, " "));
};
const debugParamActive = getParameterByName("lib_debug") === "true";
const logme = function (msg) {
return debugParamActive && console.log(msg)
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment