Fix URL params, resolve #74

This commit is contained in:
Angelos Chalaris
2017-12-13 20:02:19 +02:00
parent ce786721d5
commit afddb68d4f
2 changed files with 2 additions and 2 deletions

View File

@ -6,7 +6,7 @@ Pass `location.search` as the argument to apply to the current `url`.
```js
const getUrlParameters = url =>
url.match(/([^?=&]+)(=([^&]*))?/g).reduce(
(a,v) => (a[v.slice(0,v.indexOf('='))] = v.slice(v.indexOf('=')), a), {}
(a,v) => (a[v.slice(0,v.indexOf('='))] = v.slice(v.indexOf('=')+1), a), {}
);
// getUrlParameters('http://url.com/page?name=Adam&surname=Smith') -> {name: 'Adam', surname: 'Smith'}
```