From 0d885272f45069b1207189ae18a6f2726b4abaa9 Mon Sep 17 00:00:00 2001 From: Jack Stevenson Date: Mon, 8 Jan 2024 23:41:06 +0000 Subject: [PATCH] docs: update readme with URL support (#146) v6.0.0 introduced URL support, this PR updates the readme to document that change. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 97ec33c..e6523ba 100644 --- a/README.md +++ b/README.md @@ -47,13 +47,14 @@ serialize({ fn : function echo(arg) { return arg; }, re : /([^\s]+)/g, big : BigInt(10), + url : new URL('https://example.com/'), }); ``` The above will produce the following string output: ```js -'{"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")}' +'{"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"),"url":new URL("https://example.com/")}' ``` Note: to produce a beautified string, you can pass an optional second argument to `serialize()` to define the number of spaces to be used for the indentation.