From 51f4b23c3ab494b752d530db356e761a85f1d5bb Mon Sep 17 00:00:00 2001 From: Alex / KATT Date: Mon, 2 Oct 2023 17:30:24 +0200 Subject: [PATCH] chore: update readme code example (#17) --- CHANGELOG.md | 7 ++----- README.md | 14 ++++---------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ac4bbf0..f8571a95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,8 @@ - - # [0.9.0](https://github.com/KATT/tupleson/compare/0.8.0...0.9.0) (2023-10-01) - ### Features -* simplify symbols ([#16](https://github.com/KATT/tupleson/issues/16)) ([32720a4](https://github.com/KATT/tupleson/commit/32720a445acfcf31d51caa38dc9d7c7a165771d3)) +- simplify symbols ([#16](https://github.com/KATT/tupleson/issues/16)) ([32720a4](https://github.com/KATT/tupleson/commit/32720a445acfcf31d51caa38dc9d7c7a165771d3)) # [0.8.0](https://github.com/KATT/tupleson/compare/0.7.0...0.8.0) (2023-10-01) @@ -66,4 +63,4 @@ ### Features - initial version ([#1](https://github.com/KATT/tupleson/issues/1)) ([ccce25b](https://github.com/KATT/tupleson/commit/ccce25b6a039cf2e5c1a774c1ab022f0946ca8d5)) -- initialized repo ✨ ([c9e92a4](https://github.com/KATT/tupleson/commit/c9e92a42c97a8bc1ee3a9214f65626425c8598e3)) \ No newline at end of file +- initialized repo ✨ ([c9e92a4](https://github.com/KATT/tupleson/commit/c9e92a42c97a8bc1ee3a9214f65626425c8598e3)) diff --git a/README.md b/README.md index d2549d4a..be64a194 100644 --- a/README.md +++ b/README.md @@ -72,15 +72,9 @@ const tson = createTson({ const myObj = { foo: "bar", set: new Set([1, 2, 3]), -} as const; - -const str = tson.stringify( - { - foo: "bar", - set: new Set([1, 2, 3]), - }, - 2, -); +}; + +const str = tson.stringify(myObj, 2); console.log(str); // -> // { @@ -104,7 +98,7 @@ const obj = tson.parse(str); // ✨ Retains type integrity type Obj = typeof obj; // ^? -// type Obj = { foo: string; set: Set; } +// -> type Obj = { foo: string; set: Set; } ``` ### Extend with a custom serializer