Skip to content
Myr

fast-querystring.mts

This file

Path

benchmarks/query-param/src/fast-querystring.mts

12 lines · 357 bytes · TypeScript

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 82bdc4d point at it.

4.9.0Yusuke Wadabefore adoption82bdc4d

lines 1–12why, one step back
1import { parse } from 'fast-querystring'
23const getQueryStringFromURL = (url: string): string => {4 const queryIndex = url.indexOf('?', 8)5 const result = queryIndex !== -1 ? url.slice(queryIndex + 1) : ''6 return result7}89export default (url, key?) => {10 const data = parse(getQueryStringFromURL(url))11 return key !== undefined ? data[key] : data 12}