@tsed/json-mapper
Version:
Json mapper module for Ts.ED Framework
20 lines (17 loc) • 460 B
text/typescript
import {JsonMapper} from "../decorators/jsonMapper.js";
import {JsonMapperMethods} from "../interfaces/JsonMapperMethods.js";
/**
* Mapper for the `Symbol` type.
*
* @jsonmapper
* @component
*/
(Symbol)
export class SymbolMapper implements JsonMapperMethods {
deserialize(data: string): symbol {
return Symbol.for(data);
}
serialize(object: Symbol): any {
return object.toString().replace("Symbol(", "").replace(")", "");
}
}