-
This is a numbered list.
-
I'm going to include a fenced code block as part of this bullet:
Code More Code
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
function parseUrl(str) { | |
var link = document.createElement('a'); | |
link.href = str; | |
// Parse query string. Strip leading ?, decode, and split | |
var pairs = /^\??(.*)/.exec(decodeURI(link.search))[1].split('&'); | |
// Split pairs and create object from tuples | |
var query = _.object(_.invoke(pairs, 'split', '=')); | |
// Other url properties to copy | |
var props = [ | |
'hash', |