@rickyli79/rich-json
Version:
Serialize and Deserialize javascript objects
24 lines (23 loc) • 737 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RegExpSerializer = void 0;
const lib_1 = require("../lib");
class RegExpSerializer {
static instance;
static getInstance() {
if (this.instance === undefined) {
this.instance = (0, lib_1.createCustomerSerializer)({
class: RegExp,
toContent(value) {
return [value.source, value.flags];
},
fromContent([source, flags]) {
return new RegExp(source, flags);
},
serializContent: false,
});
}
return this.instance;
}
}
exports.RegExpSerializer = RegExpSerializer;