From 8dc2705501235dbd4305581db4fb10c252823975 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Jha Date: Sat, 27 Jul 2024 10:02:38 +0530 Subject: [PATCH] updated README and type info with strip null details --- README.md | 1 + types/index.d.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index f3a0d206..6a574472 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,7 @@ const stringify = fastJson(mySchema, { - `rounding`: setup how the `integer` types will be rounded when not integers. [More details](#integer) - `largeArrayMechanism`: set the mechanism that should be used to handle large (by default `20000` or more items) arrays. [More details](#largearrays) +- `stripNull`: removes keys with null values from serialised output. If you have lots of null values, using this will result in smallerpayload and improved performance. diff --git a/types/index.d.ts b/types/index.d.ts index 5ded284d..6dab922f 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -187,6 +187,13 @@ declare namespace build { * @default 'default' */ largeArrayMechanism?: 'default' | 'json-stringify' + + /** + * Specify if null key-value are removed from serialised JSON output, for a smaller payload + * + * @default 'false' + */ + stripNull?: boolean } export const validLargeArrayMechanisms: string[]