Skip to content

Commit b3e3823

Browse files
committed
url: improve isURL detection
PR-URL: nodejs/node#47886 Backport-PR-URL: nodejs/node#50105 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent c014855 commit b3e3823

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
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)