Skip to content

Commit

Permalink
url: improve isURL detection
Browse files Browse the repository at this point in the history
PR-URL: #47886
Backport-PR-URL: #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>
  • Loading branch information
anonrig authored and targos committed Nov 27, 2023
1 parent 1096837 commit 916a63b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/parallel/test-url-is-url.js
@@ -0,0 +1,11 @@
// Flags: --expose-internals
'use strict';

require('../common');

const { URL, parse } = require('url');
const assert = require('assert');
const { isURL } = require('internal/url');

assert.strictEqual(isURL(new URL('https://www.nodejs.org')), true);
assert.strictEqual(isURL(parse('https://www.nodejs.org')), false);

0 comments on commit 916a63b

Please sign in to comment.