Last active
November 29, 2018 08:52
-
-
Save cattaka/476258cd766e122f6060c47b70a4ef64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TEMPORARY FUNCTION pullFromQueryParams(s string, key string) | |
RETURNS string | |
LANGUAGE js AS """ | |
// function pullFromQueryParams(s, key) { | |
if (!s) return null; | |
var ts = s.split("&"); | |
for (var i = 0;i<ts.length;i++) { | |
var vs = ts[i].split("=",2); | |
if (vs[0] == key && vs.length >= 2) { | |
return decodeURIComponent(vs[1]); | |
} | |
} | |
return null; | |
// } | |
"""; | |
CREATE TEMPORARY FUNCTION pullKeysFromQueryParams(s string) | |
RETURNS array<string> | |
LANGUAGE js AS """ | |
// function pullKeysFromQueryParams(s) { | |
var results = []; | |
if (s) { | |
var ts = s.split("&"); | |
for (var i = 0;i<ts.length;i++) { | |
var vs = ts[i].split("=",2); | |
results.push(vs[0]); | |
} | |
} | |
return results; | |
// } | |
"""; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment