We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8585fac + b33cac4 commit a524d7fCopy full SHA for a524d7f
index.js
@@ -24,6 +24,10 @@ var nonLocalhostDomainRE = /^[^\s\.]+\.\S{2,}$/;
24
*/
25
26
function isUrl(string){
27
+ if (typeof string !== 'string') {
28
+ return false;
29
+ }
30
+
31
var match = string.match(protocolAndDomainRE);
32
if (!match) {
33
return false;
test/index.js
@@ -118,6 +118,22 @@ describe('is-url', function () {
118
it('google.com', function () {
119
assert(!url('google.com'));
120
});
121
122
+ it('empty', function () {
123
+ assert(!url(''));
124
+ });
125
126
+ it('undef', function () {
127
+ assert(!url(undefined));
128
129
130
+ it('object', function () {
131
+ assert(!url({}));
132
133
134
+ it('re', function () {
135
+ assert(!url(/abc/));
136
137
138
139
describe('redos', function () {
0 commit comments