* * @param {String} url * @returns {url} 将 URL 参数转换为对象 eg. getURLParameters('http://url.com/page?name=Adam&surname=Smith') // {name: 'Adam', surname: 'Smith'}
(url)
| 319 | * @returns {url} 将 URL 参数转换为对象 eg. getURLParameters('http://url.com/page?name=Adam&surname=Smith') // {name: 'Adam', surname: 'Smith'} |
| 320 | */ |
| 321 | getURLParameters(url) { |
| 322 | return (url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce( |
| 323 | (a, v) => ( |
| 324 | (a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a |
| 325 | ), |
| 326 | {} |
| 327 | ) |
| 328 | } |
| 329 | |
| 330 | /** |
| 331 | * |
nothing calls this directly
no outgoing calls
no test coverage detected