RegExpObjectSerializer.js 299 B

1234567891011121314151617
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. */
  4. "use strict";
  5. class RegExpObjectSerializer {
  6. serialize(obj, { write }) {
  7. write(obj.source);
  8. write(obj.flags);
  9. }
  10. deserialize({ read }) {
  11. return new RegExp(read(), read());
  12. }
  13. }
  14. module.exports = RegExpObjectSerializer;