Skip to content

Commit 916a63b

Browse files
anonrigtargos
authored andcommitted
url: improve isURL detection
PR-URL: #47886 Backport-PR-URL: #50105 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 1096837 commit 916a63b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/parallel/test-url-is-url.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Flags: --expose-internals
2+
'use strict';
3+
4+
require('../common');
5+
6+
const { URL, parse } = require('url');
7+
const assert = require('assert');
8+
const { isURL } = require('internal/url');
9+
10+
assert.strictEqual(isURL(new URL('https://www.nodejs.org')), true);
11+
assert.strictEqual(isURL(parse('https://www.nodejs.org')), false);

0 commit comments

Comments
 (0)