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

9 lines (7 loc) 277 B
import { functionSerializer } from "./function"; describe("Function", () => { it("should serialize", () => { const fnStr = 'function (){ return "a"; }'; expect(functionSerializer.serialize(eval(`(${fnStr}).toString()`))).toBe(fnStr); }); });