UNPKG
@fto-consult/node-utils
Version:
latest (1.9.4)
1.9.4
1.9.3
1.9.2
1.9.1
1.9.0
1.8.0
1.7.1
1.7.0
1.6.6
1.6.5
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.5.1
1.5.0
1.4.7
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.3
1.2.2
1.2.1
1.2.0
1.1.1
1.1.0
1.0.0
Bibliothèque d'outils pour application nodeJS
@fto-consult/node-utils
/
src
/
isRegex.js
10 lines
•
326 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
module
.
exports
=
function
isRegExp
(
regExp
){
if
(regExp
instanceof
RegExp
)
return
true
;
if
(!regExp ||
typeof
regExp !==
"object"
|| (!
Object
.
prototype
.
toString
.
call
(regExp).
includes
(
"RegExp"
)))
return
false
;
try
{
new
RegExp
(regExp);
return
true
; }
catch
(e) {
return
false
} }