-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
93 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3213,7 +3213,7 @@ queueMicrotask(() => console.log('called as microtask')); | |
``` | ||
#### `URL` and `URLSearchParams`[⬆](#index) | ||
[`URL` standard](https://url.spec.whatwg.org/) implementation. Modules [`web.url`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.js), [`web.url.to-json`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.to-json.js), [`web.url-search-params`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url-search-params.js). | ||
[`URL` standard](https://url.spec.whatwg.org/) implementation. Modules [`web.url`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.js), [`web.url.to-json`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.to-json.js), [`web.url-search-params`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url-search-params.js), [`web.url-search-params.size`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url-search-params.size.js). | ||
```js | ||
class URL { | ||
constructor(url: string, base?: string); | ||
|
@@ -3248,6 +3248,7 @@ class URLSearchParams { | |
keys(): Iterator<key>; | ||
values(): Iterator<value>; | ||
@@iterator(): Iterator<[key, value]>; | ||
readonly attribute size: number; | ||
} | ||
``` | ||
[*CommonJS entry points:*](#commonjs-api) | ||
|
@@ -3257,7 +3258,7 @@ core-js(-pure)/stable|actual|full/url | |
core-js/stable|actual|full/url/to-json | ||
core-js(-pure)/stable|actual|full/url-search-params | ||
``` | ||
[*Examples*](https://is.gd/AfIwve): | ||
[*Examples*](https://tinyurl.com/2fccy7sb): | ||
```js | ||
const url = new URL('https://login:[email protected]:8080/foo/bar?a=1&b=2&a=3#fragment'); | ||
|
||
|
@@ -3292,6 +3293,8 @@ params.append('c', 4); | |
params.append('a', 2); | ||
params.sort(); | ||
|
||
console.log(params.size); // => 5 | ||
|
||
for (let [key, value] of params) { | ||
console.log(key); // => 'a', 'a', 'a', 'b', 'c' | ||
console.log(value); // => '1', '3', '2', '2', '4' | ||
|
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.size.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,21 @@ | ||
'use strict'; | ||
var DESCRIPTORS = require('../internals/descriptors'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var defineBuiltInAccessor = require('../internals/define-built-in-accessor'); | ||
|
||
var URLSearchParamsPrototype = URLSearchParams.prototype; | ||
var forEach = uncurryThis(URLSearchParamsPrototype.forEach); | ||
|
||
// `URLSearchParams.prototype.size` getter | ||
// https://github.com/whatwg/url/pull/734 | ||
if (DESCRIPTORS && !('size' in URLSearchParamsPrototype)) { | ||
defineBuiltInAccessor(URLSearchParamsPrototype, 'size', { | ||
get: function size() { | ||
var count = 0; | ||
forEach(this, function () { count++; }); | ||
return count; | ||
}, | ||
configurable: true, | ||
enumerable: 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
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,4 +1,5 @@ | ||
require('../modules/web.url-search-params'); | ||
require('../modules/web.url-search-params.size'); | ||
var path = require('../internals/path'); | ||
|
||
module.exports = path.URLSearchParams; |
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,7 @@ | ||
require('../modules/web.url'); | ||
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