Function
parseType
(
x: string | null,
type: number,
parsers?: ParserOptions,
)
Source from the content-addressed store, hash-verified
| 187 | export const serializers = defaultHandlers.serializers |
| 188 | |
| 189 | export function parseType( |
| 190 | x: string | null, |
| 191 | type: number, |
| 192 | parsers?: ParserOptions, |
| 193 | ): any { |
| 194 | if (x === null) { |
| 195 | return null |
| 196 | } |
| 197 | const handler = parsers?.[type] ?? defaultHandlers.parsers[type] |
| 198 | if (handler) { |
| 199 | return handler(x, type) |
| 200 | } else { |
| 201 | return x |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | function typeHandlers(types: TypeHandlers) { |
| 206 | return Object.keys(types).reduce( |
Tested by
no test coverage detected