Travis build: 823 [ci skip]
This commit is contained in:
24
README.md
24
README.md
@ -250,6 +250,7 @@
|
|||||||
<details>
|
<details>
|
||||||
<summary>View contents</summary>
|
<summary>View contents</summary>
|
||||||
|
|
||||||
|
* [`cloneRegExp`](#cloneregexp)
|
||||||
* [`coalesce`](#coalesce)
|
* [`coalesce`](#coalesce)
|
||||||
* [`coalesceFactory`](#coalescefactory)
|
* [`coalesceFactory`](#coalescefactory)
|
||||||
* [`extendHex`](#extendhex)
|
* [`extendHex`](#extendhex)
|
||||||
@ -4284,6 +4285,29 @@ words('python, javaScript & coffee'); // ["python", "javaScript", "coffee"]
|
|||||||
---
|
---
|
||||||
## 🔧 Utility
|
## 🔧 Utility
|
||||||
|
|
||||||
|
### cloneRegExp
|
||||||
|
|
||||||
|
Clones a regular expression.
|
||||||
|
|
||||||
|
Use `new RegExp()`, `RegExp.source` and `RegExp.flags` to clone the given regular expression.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const cloneRegExp = regExp => new RegExp(regExp.source, regExp.flags);
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Examples</summary>
|
||||||
|
|
||||||
|
```js
|
||||||
|
const regExp = /lorem ipsum/gi;
|
||||||
|
const regExp2 = cloneRegExp(regExp); // /lorem ipsum/gi
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<br>[⬆ Back to top](#table-of-contents)
|
||||||
|
|
||||||
|
|
||||||
### coalesce
|
### coalesce
|
||||||
|
|
||||||
Returns the first non-null/undefined argument.
|
Returns the first non-null/undefined argument.
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user