UNPKG

typia

Version:

Superfast runtime validators with only one line

1 lines 1.12 kB
{"version":3,"file":"_jsonStringifyElement.mjs","names":[],"sources":["../../src/internal/_jsonStringifyElement.ts"],"sourcesContent":["/**\n * Writes one array or tuple element the way ECMAScript `JSON.stringify` writes\n * it.\n *\n * `SerializeJSONArray` writes `null` wherever an element serializes to\n * `undefined`, because an array position cannot be omitted without shifting\n * every element after it. A present value with no serialization — a function, a\n * symbol, or a `toJSON` returning nothing — is therefore `null`, not the\n * literal text `undefined` and not an empty slot.\n *\n * This is the fixed-position counterpart of `_jsonStringifyArray`, which\n * answers the same question while walking an array's own index range.\n *\n * @param text Serialized element value, or `undefined` when it has none.\n * @returns Element text, or `null` when the element has no serialization.\n * @internal\n */\nexport const _jsonStringifyElement = (text: string | undefined): string =>\n text === undefined ? \"null\" : text;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,yBAAyB,SACpC,SAAS,KAAA,IAAY,SAAS"}