Added a few type checking snippets from lodash
This commit is contained in:
13
snippets/isRegExp.md
Normal file
13
snippets/isRegExp.md
Normal file
@ -0,0 +1,13 @@
|
||||
### isRegExp
|
||||
|
||||
Checks if value is classified as a RegExp object.
|
||||
|
||||
Use the `instanceof`operator to check if the provided value is a `RegExp` object.
|
||||
|
||||
```js
|
||||
const isRegExp = val => val instanceof RegExp;
|
||||
```
|
||||
|
||||
```js
|
||||
isRegExp(/./g); // true
|
||||
```
|
||||
Reference in New Issue
Block a user