MCPcopy Create free account
hub / github.com/ClydeTime/Surge / getURLParameters

Method getURLParameters

Script/Env.js:321–328  ·  view source on GitHub ↗

* * @param {String} url * @returns {url} 将 URL 参数转换为对象 eg. getURLParameters('http://url.com/page?name=Adam&surname=Smith') // {name: 'Adam', surname: 'Smith'}

(url)

Source from the content-addressed store, hash-verified

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 *

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected