Created
April 18, 2019 11:33
-
-
Save CreatiCoding/f1d2717e062810c7aaad6d031c837265 to your computer and use it in GitHub Desktop.
query string to query object
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
| const queryStr2queryObj = | |
| (queryStr) => queryStr !== '' | |
| ? queryStr | |
| .split('&') | |
| .map((e) => ({ [e.split('=')[0]]: e.split('=')[1] })) | |
| .reduce((a, c) => { | |
| return { ...a, ...c }; | |
| }) | |
| : {}; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
끄앍