-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1257 from zloirock/params-has-delete-value-arg
- Loading branch information
Showing
17 changed files
with
178 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/core-js-pure/override/modules/web.url-search-params.delete.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// empty |
1 change: 1 addition & 0 deletions
1
packages/core-js-pure/override/modules/web.url-search-params.has.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use strict'; | ||
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 = 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'); | ||
|
||
params['delete']('a', 1); | ||
|
||
if (params + '' !== 'a=2') { | ||
defineBuiltIn(URLSearchParamsPrototype, 'delete', function (name /* , value */) { | ||
var length = arguments.length; | ||
var $value = length < 2 ? undefined : arguments[1]; | ||
if (length && $value === undefined) return $delete(this, name); | ||
var entries = []; | ||
forEach(this, function (v, k) { // also validates `this` | ||
push(entries, { key: k, value: v }); | ||
}); | ||
validateArgumentsLength(length, 1); | ||
var key = toString(name); | ||
var value = toString($value); | ||
var index = 0; | ||
var dindex = 0; | ||
var found = false; | ||
var entriesLength = entries.length; | ||
var entry; | ||
while (index < entriesLength) { | ||
entry = entries[index++]; | ||
if (found || entry.key === key) { | ||
found = true; | ||
$delete(this, entry.key); | ||
} else dindex++; | ||
} | ||
while (dindex < entriesLength) { | ||
entry = entries[dindex++]; | ||
if (!(entry.key === key && entry.value === value)) append(this, entry.key, entry.value); | ||
} | ||
}, { enumerable: true, unsafe: true }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
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 = URLSearchParams; | ||
var URLSearchParamsPrototype = $URLSearchParams.prototype; | ||
var getAll = uncurryThis(URLSearchParamsPrototype.getAll); | ||
var $has = uncurryThis(URLSearchParamsPrototype.has); | ||
var params = new $URLSearchParams('a=1'); | ||
|
||
if (params.has('a', 2)) { | ||
defineBuiltIn(URLSearchParamsPrototype, 'has', function has(name /* , value */) { | ||
var length = arguments.length; | ||
var $value = length < 2 ? undefined : arguments[1]; | ||
if (length && $value === undefined) return $has(this, name); | ||
var values = getAll(this, name); // also validates `this` | ||
validateArgumentsLength(length, 1); | ||
var value = toString($value); | ||
var index = 0; | ||
while (index < values.length) { | ||
if (values[index++] === value) return true; | ||
} return false; | ||
}, { enumerable: true, unsafe: true }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
// https://github.com/jasnell/proposal-url | ||
require('../modules/web.url'); | ||
require('../modules/web.url.can-parse'); | ||
require('../modules/web.url.to-json'); | ||
require('../modules/web.url-search-params'); | ||
require('../modules/web.url-search-params.size'); | ||
require('../web/url'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
require('./url-search-params'); | ||
require('../modules/web.url'); | ||
require('../modules/web.url.can-parse'); | ||
require('../modules/web.url.to-json'); | ||
require('../modules/web.url-search-params'); | ||
require('../modules/web.url-search-params.size'); | ||
var path = require('../internals/path'); | ||
|
||
module.exports = path.URL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters