Skip to content

Instantly share code, notes, and snippets.

@fb55
Created August 18, 2010 16:24
Show Gist options
  • Save fb55/535315 to your computer and use it in GitHub Desktop.
Save fb55/535315 to your computer and use it in GitHub Desktop.
//just wrote this code for a project. how cool is that?
var reqURL = (function loopRegExps (url, regExps) {
for(var i in regExps){
if(url.match(regExps[i][0])){ return (regExps[i][1] + "url=" + encodeURIcomponent(url))}
}
})(url, collectionA);
/*just some thoughts:
I would always use a named function, so it can call itself if needed. It's just a good practice.
My project is far from being finished, but someday, it will be open sourced.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment