-
-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(benchmark): add
qs
for query-param (#3674)
* chore(benchmark): add `qs` for query-param * remove unused importing
- Loading branch information
Showing
4 changed files
with
234 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import qs from 'qs' | ||
|
||
const getQueryStringFromURL = (url: string): string => { | ||
const queryIndex = url.indexOf('?', 8) | ||
const result = queryIndex !== -1 ? url.slice(queryIndex + 1) : '' | ||
return result | ||
} | ||
|
||
export default (url, key?) => { | ||
const data = qs.parse(getQueryStringFromURL(url)) | ||
return key !== undefined ? data[key] : data | ||
} |