Created
April 9, 2018 15:51
-
-
Save Akiyamka/91cbcbcb40fb3409f0ccd6f446a6a8d3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| createObjFromUrl(uriString){ | |
| if (uriString && typeof uriString === 'string' && uriString.includes('=')) { | |
| uriString = uriString.split('&').map((item) => item.split('=')); | |
| let urlObject = {}; | |
| uriString.forEach((i) => { urlObject[i[0]] = i[1]; }); | |
| return urlObject; | |
| } else { | |
| console.warn('Cannot parse that string: ' + uriString); | |
| return {}; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment