Skip to content

Commit 0849988

Browse files
committed
Update example code
1 parent e997f21 commit 0849988

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@ serialize({
4545
map : new Map([['hello', 'world']]),
4646
set : new Set([123, 456]),
4747
fn : function echo(arg) { return arg; },
48-
re : /([^\s]+)/g
48+
re : /([^\s]+)/g,
49+
big : BigInt(10),
4950
});
5051
```
5152

5253
The above will produce the following string output:
5354

5455
```js
55-
'{"str":"string","num":0,"obj":{"foo":"foo"},"arr":[1,2,3],"bool":true,"nil":null,"undef":undefined,"inf":Infinity,"date":new Date("2016-04-28T22:02:17.000Z"),"map":new Map([["hello","world"]]),"set":new Set([123,456]),"fn":function echo(arg) { return arg; },"re":new RegExp("([^\\\\s]+)", "g")}'
56+
'{"str":"string","num":0,"obj":{"foo":"foo"},"arr":[1,2,3],"bool":true,"nil":null,"undef":undefined,"inf":Infinity,"date":new Date("2016-04-28T22:02:17.000Z"),"map":new Map([["hello","world"]]),"set":new Set([123,456]),"fn":function echo(arg) { return arg; },"re":new RegExp("([^\\\\s]+)", "g"),"big":BigInt("10")}'
5657
```
5758

5859
Note: to produced a beautified string, you can pass an optional second argument to `serialize()` to define the number of spaces to be used for the indentation.

0 commit comments

Comments
 (0)