Skip to content

Commit cafdde7

Browse files
committedDec 15, 2021
add a structuredClone example
1 parent c124e00 commit cafdde7

File tree

4 files changed

+44
-24
lines changed

4 files changed

+44
-24
lines changed
 

‎README.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,30 @@ The maintainers of `core-js` and thousands of other packages are working with Ti
3030

3131
---
3232

33-
[*Example of usage*](https://is.gd/yHurcF):
33+
[*Example of usage*](https://is.gd/FdIG6n):
3434
```js
3535
import 'core-js'; // <- at the top of your entry point
3636

3737
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
3838
[1, 2, 3, 4].findLast(it => it % 2); // => 3
3939
Promise.resolve(42).then(x => console.log(x)); // => 42
40+
structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
4041
queueMicrotask(() => console.log('called as microtask'));
4142
```
4243

4344
*You can load only required features*:
4445
```js
45-
import 'core-js/actual/array/from'; // <- at the top of your entry point
46-
import 'core-js/actual/array/find-last'; // <- at the top of your entry point
47-
import 'core-js/actual/set'; // <- at the top of your entry point
48-
import 'core-js/actual/promise'; // <- at the top of your entry point
49-
import 'core-js/actual/queue-microtask'; // <- at the top of your entry point
46+
import 'core-js/actual/array/from'; // <- at the top of your entry point
47+
import 'core-js/actual/array/find-last'; // <- at the top of your entry point
48+
import 'core-js/actual/set'; // <- at the top of your entry point
49+
import 'core-js/actual/promise'; // <- at the top of your entry point
50+
import 'core-js/actual/structured-clone'; // <- at the top of your entry point
51+
import 'core-js/actual/queue-microtask'; // <- at the top of your entry point
5052

5153
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
5254
[1, 2, 3, 4].findLast(it => it % 2); // => 3
5355
Promise.resolve(42).then(x => console.log(x)); // => 42
56+
structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
5457
queueMicrotask(() => console.log('called as microtask'));
5558
```
5659

@@ -60,11 +63,13 @@ import from from 'core-js-pure/actual/array/from';
6063
import findLast from 'core-js-pure/actual/array/find-last';
6164
import Set from 'core-js-pure/actual/set';
6265
import Promise from 'core-js-pure/actual/promise';
66+
import structuredClone from 'core-js-pure/actual/structured-clone';
6367
import queueMicrotask from 'core-js-pure/actual/queue-microtask';
6468

6569
from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
6670
findLast([1, 2, 3, 4], it => it % 2); // => 3
6771
Promise.resolve(42).then(x => console.log(x)); // => 42
72+
structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
6873
queueMicrotask(() => console.log('called as microtask'));
6974
```
7075

‎packages/core-js-bundle/README.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,30 @@
2222

2323
---
2424

25-
[*Example of usage*](https://is.gd/yHurcF):
25+
[*Example of usage*](https://is.gd/FdIG6n):
2626
```js
2727
import 'core-js'; // <- at the top of your entry point
2828

2929
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
3030
[1, 2, 3, 4].findLast(it => it % 2); // => 3
3131
Promise.resolve(42).then(x => console.log(x)); // => 42
32+
structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
3233
queueMicrotask(() => console.log('called as microtask'));
3334
```
3435

3536
*You can load only required features*:
3637
```js
37-
import 'core-js/actual/array/from'; // <- at the top of your entry point
38-
import 'core-js/actual/array/find-last'; // <- at the top of your entry point
39-
import 'core-js/actual/set'; // <- at the top of your entry point
40-
import 'core-js/actual/promise'; // <- at the top of your entry point
41-
import 'core-js/actual/queue-microtask'; // <- at the top of your entry point
38+
import 'core-js/actual/array/from'; // <- at the top of your entry point
39+
import 'core-js/actual/array/find-last'; // <- at the top of your entry point
40+
import 'core-js/actual/set'; // <- at the top of your entry point
41+
import 'core-js/actual/promise'; // <- at the top of your entry point
42+
import 'core-js/actual/structured-clone'; // <- at the top of your entry point
43+
import 'core-js/actual/queue-microtask'; // <- at the top of your entry point
4244

4345
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
4446
[1, 2, 3, 4].findLast(it => it % 2); // => 3
4547
Promise.resolve(42).then(x => console.log(x)); // => 42
48+
structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
4649
queueMicrotask(() => console.log('called as microtask'));
4750
```
4851

@@ -52,11 +55,13 @@ import from from 'core-js-pure/actual/array/from';
5255
import findLast from 'core-js-pure/actual/array/find-last';
5356
import Set from 'core-js-pure/actual/set';
5457
import Promise from 'core-js-pure/actual/promise';
58+
import structuredClone from 'core-js-pure/actual/structured-clone';
5559
import queueMicrotask from 'core-js-pure/actual/queue-microtask';
5660

5761
from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
5862
findLast([1, 2, 3, 4], it => it % 2); // => 3
5963
Promise.resolve(42).then(x => console.log(x)); // => 42
64+
structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
6065
queueMicrotask(() => console.log('called as microtask'));
6166
```
6267

‎packages/core-js-pure/README.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,30 @@
2222

2323
---
2424

25-
[*Example of usage*](https://is.gd/yHurcF):
25+
[*Example of usage*](https://is.gd/FdIG6n):
2626
```js
2727
import 'core-js'; // <- at the top of your entry point
2828

2929
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
3030
[1, 2, 3, 4].findLast(it => it % 2); // => 3
3131
Promise.resolve(42).then(x => console.log(x)); // => 42
32+
structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
3233
queueMicrotask(() => console.log('called as microtask'));
3334
```
3435

3536
*You can load only required features*:
3637
```js
37-
import 'core-js/actual/array/from'; // <- at the top of your entry point
38-
import 'core-js/actual/array/find-last'; // <- at the top of your entry point
39-
import 'core-js/actual/set'; // <- at the top of your entry point
40-
import 'core-js/actual/promise'; // <- at the top of your entry point
41-
import 'core-js/actual/queue-microtask'; // <- at the top of your entry point
38+
import 'core-js/actual/array/from'; // <- at the top of your entry point
39+
import 'core-js/actual/array/find-last'; // <- at the top of your entry point
40+
import 'core-js/actual/set'; // <- at the top of your entry point
41+
import 'core-js/actual/promise'; // <- at the top of your entry point
42+
import 'core-js/actual/structured-clone'; // <- at the top of your entry point
43+
import 'core-js/actual/queue-microtask'; // <- at the top of your entry point
4244

4345
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
4446
[1, 2, 3, 4].findLast(it => it % 2); // => 3
4547
Promise.resolve(42).then(x => console.log(x)); // => 42
48+
structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
4649
queueMicrotask(() => console.log('called as microtask'));
4750
```
4851

@@ -52,11 +55,13 @@ import from from 'core-js-pure/actual/array/from';
5255
import findLast from 'core-js-pure/actual/array/find-last';
5356
import Set from 'core-js-pure/actual/set';
5457
import Promise from 'core-js-pure/actual/promise';
58+
import structuredClone from 'core-js-pure/actual/structured-clone';
5559
import queueMicrotask from 'core-js-pure/actual/queue-microtask';
5660

5761
from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
5862
findLast([1, 2, 3, 4], it => it % 2); // => 3
5963
Promise.resolve(42).then(x => console.log(x)); // => 42
64+
structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
6065
queueMicrotask(() => console.log('called as microtask'));
6166
```
6267

‎packages/core-js/README.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,30 @@
2222

2323
---
2424

25-
[*Example of usage*](https://is.gd/yHurcF):
25+
[*Example of usage*](https://is.gd/FdIG6n):
2626
```js
2727
import 'core-js'; // <- at the top of your entry point
2828

2929
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
3030
[1, 2, 3, 4].findLast(it => it % 2); // => 3
3131
Promise.resolve(42).then(x => console.log(x)); // => 42
32+
structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
3233
queueMicrotask(() => console.log('called as microtask'));
3334
```
3435

3536
*You can load only required features*:
3637
```js
37-
import 'core-js/actual/array/from'; // <- at the top of your entry point
38-
import 'core-js/actual/array/find-last'; // <- at the top of your entry point
39-
import 'core-js/actual/set'; // <- at the top of your entry point
40-
import 'core-js/actual/promise'; // <- at the top of your entry point
41-
import 'core-js/actual/queue-microtask'; // <- at the top of your entry point
38+
import 'core-js/actual/array/from'; // <- at the top of your entry point
39+
import 'core-js/actual/array/find-last'; // <- at the top of your entry point
40+
import 'core-js/actual/set'; // <- at the top of your entry point
41+
import 'core-js/actual/promise'; // <- at the top of your entry point
42+
import 'core-js/actual/structured-clone'; // <- at the top of your entry point
43+
import 'core-js/actual/queue-microtask'; // <- at the top of your entry point
4244

4345
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
4446
[1, 2, 3, 4].findLast(it => it % 2); // => 3
4547
Promise.resolve(42).then(x => console.log(x)); // => 42
48+
structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
4649
queueMicrotask(() => console.log('called as microtask'));
4750
```
4851

@@ -52,11 +55,13 @@ import from from 'core-js-pure/actual/array/from';
5255
import findLast from 'core-js-pure/actual/array/find-last';
5356
import Set from 'core-js-pure/actual/set';
5457
import Promise from 'core-js-pure/actual/promise';
58+
import structuredClone from 'core-js-pure/actual/structured-clone';
5559
import queueMicrotask from 'core-js-pure/actual/queue-microtask';
5660

5761
from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
5862
findLast([1, 2, 3, 4], it => it % 2); // => 3
5963
Promise.resolve(42).then(x => console.log(x)); // => 42
64+
structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
6065
queueMicrotask(() => console.log('called as microtask'));
6166
```
6267

0 commit comments

Comments
 (0)
Please sign in to comment.