What do you think about omitting null values, so those fall in the same bucket as the default switch case? I'd prefer to have a clean output with all valid values, and skipping null entries without having to check in each <JsonLd> invocation?
switch (typeof value) {
case "object":
return value; // JSON.stringify will recursively call replacer.
case "number":
case "boolean":
case "bigint":
return value; // These values are not risky.
case "string":
return value.replace(/[&<>'"]/g, replace);
default: {
// We shouldn't expect other types.
isNever(value);
// JSON.stringify will remove this element.
return undefined;
}
}
What do you think about omitting null values, so those fall in the same bucket as the default switch case? I'd prefer to have a clean output with all valid values, and skipping null entries without having to check in each
<JsonLd>
invocation?