@tsed/json-mapper
Version:
Json mapper module for Ts.ED Framework
18 lines (17 loc) • 503 B
JavaScript
/**
* @ignore
*/
// tslint:disable-next-line:variable-name
const JsonMapperTypesContainer = new Map();
/**
* Register a mapper class for a specific primitive/complex type so it can be reused by the serializers.
*/
export function registerJsonTypeMapper(type, token) {
JsonMapperTypesContainer.set(type, new token());
}
/**
* Retrieve the registry of custom JSON mapper instances keyed by the types they support.
*/
export function getJsonMapperTypes() {
return JsonMapperTypesContainer;
}