Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 1x 1x 1x | import * as qs from './querystring'; export const getQuery = (name: string, search?: string): string => { const reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`, 'i'); const values = reg.exec((search || window.location.search).substr(1)); if (values != null) { return unescape(values[2]) || ''; } return ''; }; export const getQueries = (search?: string): Record<string, string> => { let str = search || window.location.search str = str.replace('?', ''); let result = qs.parse(str); return (result || {}) as Record<string, string>; } |