|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
846 bytes
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | "use strict";
|
|---|
| 6 |
|
|---|
| 7 | /** @typedef {import("./ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|---|
| 8 | /** @typedef {import("./ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|---|
| 9 |
|
|---|
| 10 | class RegExpObjectSerializer {
|
|---|
| 11 | /**
|
|---|
| 12 | * Serializes this instance into the provided serializer context.
|
|---|
| 13 | * @param {RegExp} obj regexp
|
|---|
| 14 | * @param {ObjectSerializerContext} context context
|
|---|
| 15 | */
|
|---|
| 16 | serialize(obj, context) {
|
|---|
| 17 | context.write(obj.source);
|
|---|
| 18 | context.write(obj.flags);
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | /**
|
|---|
| 22 | * Restores this instance from the provided deserializer context.
|
|---|
| 23 | * @param {ObjectDeserializerContext} context context
|
|---|
| 24 | * @returns {RegExp} regexp
|
|---|
| 25 | */
|
|---|
| 26 | deserialize(context) {
|
|---|
| 27 | return new RegExp(context.read(), context.read());
|
|---|
| 28 | }
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | module.exports = RegExpObjectSerializer;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.