( value: value )
| 22 | let lastSerialized: string |
| 23 | |
| 24 | export const serializePrimitive = <value extends SerializablePrimitive>( |
| 25 | value: value |
| 26 | ): serializePrimitive<value> => |
| 27 | (typeof value === "string" ? |
| 28 | value === lastString ? |
| 29 | lastSerialized |
| 30 | : (lastSerialized = JSON.stringify((lastString = value))) |
| 31 | : typeof value === "bigint" ? `${value}n` |
| 32 | : `${value}`) as never |
| 33 | |
| 34 | export type serializePrimitive<value extends SerializablePrimitive> = |
| 35 | value extends string ? `"${value}"` |
no outgoing calls
no test coverage detected