UNPKG

@tsed/schema

Version:
19 lines (18 loc) 603 B
import { execMapper, registerJsonSchemaMapper } from "../../registries/JsonSchemaMapperContainer.js"; /** * Serialize class which inherit from Map like JsonMap, JsonOperation, JsonParameter. * @param input * @param ignore * @param options * @ignore */ export function mapMapper(input, { ignore = [], ...options } = {}) { return Array.from(input.entries()).reduce((obj, [key, value]) => { if (ignore.includes(key)) { return obj; } obj[key] = execMapper("item", [value], options); return obj; }, {}); } registerJsonSchemaMapper("map", mapMapper);