main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
712 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 | * @param {RegExp} obj regexp
|
---|
13 | * @param {ObjectSerializerContext} context context
|
---|
14 | */
|
---|
15 | serialize(obj, context) {
|
---|
16 | context.write(obj.source);
|
---|
17 | context.write(obj.flags);
|
---|
18 | }
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * @param {ObjectDeserializerContext} context context
|
---|
22 | * @returns {RegExp} regexp
|
---|
23 | */
|
---|
24 | deserialize(context) {
|
---|
25 | return new RegExp(context.read(), context.read());
|
---|
26 | }
|
---|
27 | }
|
---|
28 |
|
---|
29 | module.exports = RegExpObjectSerializer;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.