Travis build: 763 [ci skip]
This commit is contained in:
54
README.md
54
README.md
@ -91,7 +91,6 @@
|
||||
* [`elementIsVisibleInViewport`](#elementisvisibleinviewport)
|
||||
* [`getScrollPosition`](#getscrollposition)
|
||||
* [`getStyle`](#getstyle)
|
||||
* [`getURLParameters`](#geturlparameters)
|
||||
* [`hasClass`](#hasclass)
|
||||
* [`hide`](#hide)
|
||||
* [`httpsRedirect`](#httpsredirect)
|
||||
@ -244,6 +243,7 @@
|
||||
* [`coalesceFactory`](#coalescefactory)
|
||||
* [`extendHex`](#extendhex)
|
||||
* [`getType`](#gettype)
|
||||
* [`getURLParameters`](#geturlparameters)
|
||||
* [`hexToRGB`](#hextorgb)
|
||||
* [`isArray`](#isarray)
|
||||
* [`isArrayLike`](#isarraylike)
|
||||
@ -1707,32 +1707,6 @@ getStyle(document.querySelector('p'), 'font-size'); // '16px'
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### getURLParameters
|
||||
|
||||
Returns an object containing the parameters of the current URL.
|
||||
|
||||
Use `match()` with an appropriate regular expression to get all key-value pairs, `Array.reduce()` to map and combine them into a single object.
|
||||
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('=') + 1)), a), {});
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
getURLParameters('http://url.com/page?name=Adam&surname=Smith'); // {name: 'Adam', surname: 'Smith'}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### hasClass
|
||||
|
||||
Returns `true` if the element has the specified class, `false` otherwise.
|
||||
@ -4052,6 +4026,32 @@ getType(new Set([1, 2, 3])); // "set"
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### getURLParameters
|
||||
|
||||
Returns an object containing the parameters of the current URL.
|
||||
|
||||
Use `match()` with an appropriate regular expression to get all key-value pairs, `Array.reduce()` to map and combine them into a single object.
|
||||
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('=') + 1)), a), {});
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
getURLParameters('http://url.com/page?name=Adam&surname=Smith'); // {name: 'Adam', surname: 'Smith'}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### hexToRGB
|
||||
|
||||
Converts a color code to a `rgb()` or `rgba()` string if alpha value is provided.
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user