UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

28 lines (20 loc) 554 B
/** * extracts hash parameters * @returns {Object<string>} */ export function getURLHash() { const result = {}; if (window === undefined) { return result; } const location = window.location; const hash = location.hash; const hashRegEx = /([a-zA-Z0-9\-\_]+)\=([a-zA-Z0-9\-\_]+)/g; let match; while ((match = hashRegEx.exec(hash)) !== null) { const variableName = match[1]; const value = match[2]; result[variableName] = value; } return result; }