You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
parttimejob/node_modules/core-js/modules/web.url.parse.js

24 lines
801 B

'use strict';
var $ = require('../internals/export');
var getBuiltIn = require('../internals/get-built-in');
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');
// `URL.parse` method
// https://url.spec.whatwg.org/#dom-url-canparse
$({ target: 'URL', stat: true, forced: !USE_NATIVE_URL }, {
parse: function parse(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 null;
}
}
});