Sha256: 3e32d4713602973d031749040e84e5b2f343ecf38dc46ba98c2ff53f39aa521b

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

'use strict';
var $ = require('../internals/export');
var getBuiltIn = require('../internals/get-built-in');
var fails = require('../internals/fails');
var validateArgumentsLength = require('../internals/validate-arguments-length');
var toString = require('../internals/to-string');
var USE_NATIVE_URL = require('../internals/url-constructor-detection');

var URL = getBuiltIn('URL');

// https://github.com/nodejs/node/issues/47505
// https://github.com/denoland/deno/issues/18893
var THROWS_WITHOUT_ARGUMENTS = USE_NATIVE_URL && fails(function () {
  URL.canParse();
});

// `URL.canParse` method
// https://url.spec.whatwg.org/#dom-url-canparse
$({ target: 'URL', stat: true, forced: !THROWS_WITHOUT_ARGUMENTS }, {
  canParse: function canParse(url) {
    var length = validateArgumentsLength(arguments.length, 1);
    var urlString = toString(url);
    var base = length < 2 || arguments[1] === undefined ? undefined : toString(arguments[1]);
    try {
      return !!new URL(urlString, base);
    } catch (error) {
      return false;
    }
  }
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-0.26.10 packages/webpacker/node_modules/core-js/modules/web.url.can-parse.js
decidim-0.26.9 packages/webpacker/node_modules/core-js/modules/web.url.can-parse.js
decidim-0.28.0.rc5 packages/webpacker/node_modules/core-js/modules/web.url.can-parse.js
decidim-0.28.0.rc4 packages/webpacker/node_modules/core-js/modules/web.url.can-parse.js