@@ -154,10 +154,10 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
154
154
- [ ` Symbol.prototype.description ` ] ( #symbolprototypedescription )
155
155
- [ Well-formed ` JSON.stringify ` ] ( #well-formed-jsonstringify )
156
156
- [ Well-formed unicode strings] ( #well-formed-unicode-strings )
157
+ - [ New ` Set ` methods] ( #new-set-methods )
157
158
- [ Stage 3 proposals] ( #stage-3-proposals )
158
159
- [ ` Iterator ` helpers] ( #iterator-helpers )
159
160
- [ ` Array.fromAsync ` ] ( #arrayfromasync )
160
- - [ New ` Set ` methods] ( #new-set-methods )
161
161
- [ ` JSON.parse ` source text access] ( #jsonparse-source-text-access )
162
162
- [ ` Float16 ` methods] ( #float16-methods )
163
163
- [ Explicit resource management] ( #explicit-resource-management )
@@ -1499,7 +1499,7 @@ map.get(1); // => [1, 3, 5]
1499
1499
map .get (0 ); // => [2, 4]
1500
1500
` ` `
1501
1501
#### Set[⬆](#index)
1502
- Module [` es .set ` ](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.js).
1502
+ Modules [` es .set ` ](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.js), [ ` es . set . difference . v2 ` ](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.difference.v2.js), [ ` es . set . intersection . v2 ` ](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.intersection.v2.js), [ ` es . set . is - disjoint - from . v2 ` ](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.is-disjoint-from.v2.js), [ ` es . set . is - subset - of . v2 ` ](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.is-subset-of.v2.js), [ ` es . set . is - superset - of . v2 ` ](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.is-superset-of.v2.js), [ ` es . set . symmetric - difference . v2 ` ](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.symmetric-difference.v2.js), [ ` es . set . union . v2 ` ](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.union.v2.js)
1503
1503
` ` ` js
1504
1504
class Set {
1505
1505
constructor (iterable ?: Iterable < value > ): Set;
@@ -1511,15 +1511,29 @@ class Set {
1511
1511
values(): Iterator<value>;
1512
1512
keys(): Iterator<value>;
1513
1513
entries(): Iterator<[value, value]>;
1514
+ difference(other: SetLike<mixed>): Set;
1515
+ intersection(other: SetLike<mixed>): Set;
1516
+ isDisjointFrom(other: SetLike<mixed>): boolean;
1517
+ isSubsetOf(other: SetLike<mixed>): boolean;
1518
+ isSupersetOf(other: SetLike<mixed>): boolean;
1519
+ symmetricDifference(other: SetLike<mixed>): Set;
1520
+ union(other: SetLike<mixed>): Set;
1514
1521
@@iterator(): Iterator<value>;
1515
1522
readonly attribute size: number;
1516
1523
}
1517
1524
` ` `
1518
1525
[*CommonJS entry points:*](#commonjs-api)
1519
1526
` ` `
1520
1527
core- js (- pure)/ es| stable| actual| full/ set
1528
+ core- js (- pure)/ es| stable| actual| full/ set/ difference
1529
+ core- js (- pure)/ es| stable| actual| full/ set/ intersection
1530
+ core- js (- pure)/ es| stable| actual| full/ set/ is- disjoint- from
1531
+ core- js (- pure)/ es| stable| actual| full/ set/ is- subset- of
1532
+ core- js (- pure)/ es| stable| actual| full/ set/ is- superset- of
1533
+ core- js (- pure)/ es| stable| actual| full/ set/ symmetric- difference
1534
+ core- js (- pure)/ es| stable| actual| full/ set/ union
1521
1535
` ` `
1522
- [*Examples*](https://goo.gl/bmhLwg ):
1536
+ [*Examples*](https://tinyurl.com/2dy5t9ey ):
1523
1537
` ` ` js
1524
1538
let set = new Set ([' a' , ' b' , ' a' , ' c' ]);
1525
1539
set .add (' d' ).add (' b' ).add (' e' );
@@ -1542,6 +1556,14 @@ for (let [key, value] of set.entries()) {
1542
1556
console .log (key); // => 1, 2, 3
1543
1557
console .log (value); // => 1, 2, 3
1544
1558
}
1559
+
1560
+ new Set ([1 , 2 , 3 ]).union (new Set ([3 , 4 , 5 ])); // => Set {1, 2, 3, 4, 5}
1561
+ new Set ([1 , 2 , 3 ]).intersection (new Set ([3 , 4 , 5 ])); // => Set {3}
1562
+ new Set ([1 , 2 , 3 ]).difference (new Set ([3 , 4 , 5 ])); // => Set {1, 2}
1563
+ new Set ([1 , 2 , 3 ]).symmetricDifference (new Set ([3 , 4 , 5 ])); // => Set {1, 2, 4, 5}
1564
+ new Set ([1 , 2 , 3 ]).isDisjointFrom (new Set ([4 , 5 , 6 ])); // => true
1565
+ new Set ([1 , 2 , 3 ]).isSubsetOf (new Set ([5 , 4 , 3 , 2 , 1 ])); // => true
1566
+ new Set ([5 , 4 , 3 , 2 , 1 ]).isSupersetOf (new Set ([1 , 2 , 3 ])); // => true
1545
1567
` ` `
1546
1568
#### WeakMap[⬆](#index)
1547
1569
Module [` es .weak - map` ](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.weak-map.js).
@@ -2236,6 +2258,22 @@ class String {
2236
2258
` ` ` js
2237
2259
core-js/proposals/well-formed-unicode-strings
2238
2260
` ` `
2261
+ ##### [New ` Set` methods](https: // github.com/tc39/proposal-set-methods)[⬆](#index)
2262
+ ` ` ` js
2263
+ class Set {
2264
+ difference(other: SetLike<mixed>): Set;
2265
+ intersection(other: SetLike<mixed>): Set;
2266
+ isDisjointFrom(other: SetLike<mixed>): boolean;
2267
+ isSubsetOf(other: SetLike<mixed>): boolean;
2268
+ isSupersetOf(other: SetLike<mixed>): boolean;
2269
+ symmetricDifference(other: SetLike<mixed>): Set;
2270
+ union(other: SetLike<mixed>): Set;
2271
+ }
2272
+ ` ` `
2273
+ [* CommonJS entry points: * ](#commonjs- api)
2274
+ ` ` ` js
2275
+ core-js/proposals/set-methods-v2
2276
+ ` ` `
2239
2277
2240
2278
#### Stage 3 proposals[⬆](#index)
2241
2279
@@ -2314,40 +2352,6 @@ core-js(-pure)/actual|full/array/from-async
2314
2352
` ` ` js
2315
2353
await Array.fromAsync((async function * (){ yield * [1, 2, 3] })(), i => i * i); // => [1, 4, 9]
2316
2354
` ` `
2317
- ##### [New ` Set` methods](https: // github.com/tc39/proposal-set-methods)[⬆](#index)
2318
- Modules [` esnext.set.difference.v2` ](https: // github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.difference.v2.js), [`esnext.set.intersection.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.intersection.v2.js), [`esnext.set.is-disjoint-from.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.is-disjoint-from.v2.js), [`esnext.set.is-subset-of.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.is-subset-of.v2.js), [`esnext.set.is-superset-of.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.is-superset-of.v2.js), [`esnext.set.symmetric-difference.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.symmetric-difference.v2.js), [`esnext.set.union.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.union.v2.js)
2319
- ` ` ` js
2320
- class Set {
2321
- difference(other: SetLike<mixed>): Set;
2322
- intersection(other: SetLike<mixed>): Set;
2323
- isDisjointFrom(other: SetLike<mixed>): boolean;
2324
- isSubsetOf(other: SetLike<mixed>): boolean;
2325
- isSupersetOf(other: SetLike<mixed>): boolean;
2326
- symmetricDifference(other: SetLike<mixed>): Set;
2327
- union(other: SetLike<mixed>): Set;
2328
- }
2329
- ` ` `
2330
- [* CommonJS entry points: * ](#commonjs- api)
2331
- ` ` ` js
2332
- core-js/proposals/set-methods-v2
2333
- core-js(-pure)/actual|full/set/difference
2334
- core-js(-pure)/actual|full/set/intersection
2335
- core-js(-pure)/actual|full/set/is-disjoint-from
2336
- core-js(-pure)/actual|full/set/is-subset-of
2337
- core-js(-pure)/actual|full/set/is-superset-of
2338
- core-js(-pure)/actual|full/set/symmetric-difference
2339
- core-js(-pure)/actual|full/set/union
2340
- ` ` `
2341
- [* Examples* ](https: // tinyurl.com/2henaoac):
2342
- ` ` ` js
2343
- new Set([1, 2, 3]).union(new Set([3, 4, 5])); // => Set {1, 2, 3, 4, 5}
2344
- new Set([1, 2, 3]).intersection(new Set([3, 4, 5])); // => Set {3}
2345
- new Set([1, 2, 3]).difference(new Set([3, 4, 5])); // => Set {1, 2}
2346
- new Set([1, 2, 3]).symmetricDifference(new Set([3, 4, 5])); // => Set {1, 2, 4, 5}
2347
- new Set([1, 2, 3]).isDisjointFrom(new Set([4, 5, 6])); // => true
2348
- new Set([1, 2, 3]).isSubsetOf(new Set([5, 4, 3, 2, 1])); // => true
2349
- new Set([5, 4, 3, 2, 1]).isSupersetOf(new Set([1, 2, 3])); // => true
2350
- ` ` `
2351
2355
2352
2356
##### [` JSON.parse` source text access](https: // github.com/tc39/proposal-json-parse-with-source)[⬆](#index)
2353
2357
Modules [` esnext.json.is-raw-json` ](https: // github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.json.is-raw-json.js), [`esnext.json.parse`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.json.parse.js), [`esnext.json.raw-json`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.json.raw-json.js).
0 commit comments