MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / serializer

Function serializer

framework/framework/serializer.ts:3–11  ·  view source on GitHub ↗
(ignoreSerializeFunction = false, h?: HandlerCommon)

Source from the content-addressed store, hash-verified

1import type { HandlerCommon } from './server';
2
3export default function serializer(ignoreSerializeFunction = false, h?: HandlerCommon) {
4 return (k: string, v: any) => {
5 if (k.startsWith('_') && k !== '_id') return undefined;
6 if (typeof v === 'bigint') return `BigInt::${v.toString()}`;
7 if (!ignoreSerializeFunction && v && typeof v === 'object'
8 && 'serialize' in v && typeof v.serialize === 'function') return v.serialize(h);
9 return v;
10 };
11}

Callers 4

renderFunction · 0.90
base.tsFile · 0.90
renderHTMLMethod · 0.85
sendMethod · 0.85

Calls 1

serializeMethod · 0.45

Tested by

no test coverage detected