UNPKG

@safejs/serializer

Version:

Serializer is a superset of JSON that includes recursive objects, dates, regular expressions, functions and others which you also can expand by yourself

8 lines (6 loc) 359 B
import { ExtraSerializer } from "../../types"; export const symbolSerializer: ExtraSerializer<Symbol, string> = { determine: (v) => typeof v === "symbol", serialize: (v: any) => (typeof v.description === "string" ? v.description : null), deserialize: (description) => (typeof description === "string" ? Symbol(description) : Symbol()), };