You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
601 B
30 lines
601 B
4 weeks ago
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.replacer = replacer;
|
||
|
exports.reviver = reviver;
|
||
|
|
||
|
function replacer(_key, value) {
|
||
|
if (value instanceof RegExp) {
|
||
|
return {
|
||
|
__serialized_type: 'RegExp',
|
||
|
source: value.source,
|
||
|
flags: value.flags
|
||
|
};
|
||
|
}
|
||
|
|
||
|
return value;
|
||
|
}
|
||
|
|
||
|
function reviver(_key, value) {
|
||
|
if (typeof value === 'object' && value !== null) {
|
||
|
// eslint-disable-next-line no-underscore-dangle
|
||
|
if (value.__serialized_type === 'RegExp') {
|
||
|
return new RegExp(value.source, value.flags);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return value;
|
||
|
}
|