@tsed/schema
Version:
JsonSchema module for Ts.ED Framework
19 lines (18 loc) • 603 B
JavaScript
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);