"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.serializeRegExp = exports.isSerializedRegExp = exports.isRegExp = exports.deserializeRegExp = void 0;
const isRegExp = exp => {
  return exp instanceof RegExp;
};
exports.isRegExp = isRegExp;
const isSerializedRegExp = exp => {
  return typeof exp === 'object' && exp !== null && Reflect.get(exp, '__regexp') === true;
};
exports.isSerializedRegExp = isSerializedRegExp;
const serializeRegExp = exp => {
  const {
    source,
    flags
  } = exp;
  return {
    __regexp: true,
    source,
    flags
  };
};
exports.serializeRegExp = serializeRegExp;
const deserializeRegExp = _ref => {
  let {
    source,
    flags
  } = _ref;
  return new RegExp(source, flags);
};
exports.deserializeRegExp = deserializeRegExp;