Skip to content

Commit

Permalink
add a pure version special case
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jun 10, 2023
1 parent ba1da6b commit f87d219
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// empty
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// empty
4 changes: 3 additions & 1 deletion packages/core-js/internals/url-constructor-detection.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ module.exports = !fails(function () {
// eslint-disable-next-line unicorn/relative-url-style -- required for testing
var url = new URL('b?a=1&b=2&c=3', 'http://a');
var searchParams = url.searchParams;
var searchParams2 = new URLSearchParams('a=1&a=2');
var result = '';
url.pathname = 'c%20d';
searchParams.forEach(function (value, key) {
searchParams['delete']('b');
result += key + value;
});
return (IS_PURE && !url.toJSON)
searchParams2['delete']('a', 2);
return (IS_PURE && (!url.toJSON || !searchParams2.has('a', 1) || searchParams2.has('a', 2)))
|| (!searchParams.size && (IS_PURE || !DESCRIPTORS))
|| !searchParams.sort
|| url.href !== 'http://a/c%20d?a=1&c=3'
Expand Down
7 changes: 3 additions & 4 deletions packages/core-js/modules/web.url-search-params.delete.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
'use strict';
var getBuiltIn = require('../internals/get-built-in');
var defineBuiltIn = require('../internals/define-built-in');
var uncurryThis = require('../internals/function-uncurry-this');
var toString = require('../internals/to-string');
var validateArgumentsLength = require('../internals/validate-arguments-length');

var URLSearchParams = getBuiltIn('URLSearchParams');
var URLSearchParamsPrototype = URLSearchParams.prototype;
var $URLSearchParams = URLSearchParams;
var URLSearchParamsPrototype = $URLSearchParams.prototype;
var append = uncurryThis(URLSearchParamsPrototype.append);
var $delete = uncurryThis(URLSearchParamsPrototype['delete']);
var forEach = uncurryThis(URLSearchParamsPrototype.forEach);
var push = uncurryThis([].push);
var params = new URLSearchParams('a=1&a=2');
var params = new $URLSearchParams('a=1&a=2');

params['delete']('a', 1);

Expand Down
7 changes: 3 additions & 4 deletions packages/core-js/modules/web.url-search-params.has.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
'use strict';
var getBuiltIn = require('../internals/get-built-in');
var defineBuiltIn = require('../internals/define-built-in');
var uncurryThis = require('../internals/function-uncurry-this');
var toString = require('../internals/to-string');
var validateArgumentsLength = require('../internals/validate-arguments-length');

var URLSearchParams = getBuiltIn('URLSearchParams');
var URLSearchParamsPrototype = URLSearchParams.prototype;
var $URLSearchParams = URLSearchParams;
var URLSearchParamsPrototype = $URLSearchParams.prototype;
var getAll = uncurryThis(URLSearchParamsPrototype.getAll);
var $has = uncurryThis(URLSearchParamsPrototype.has);
var params = new URLSearchParams('a=1');
var params = new $URLSearchParams('a=1');

if (params.has('a', 2)) {
defineBuiltIn(URLSearchParamsPrototype, 'has', function has(name /* , value */) {
Expand Down

0 comments on commit f87d219

Please sign in to comment.