source: trip-planner-front/node_modules/webpack/lib/serialization/MapObjectSerializer.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 554 bytes
RevLine 
[6a3a178]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3*/
4
5"use strict";
6
7class MapObjectSerializer {
8 serialize(obj, { write }) {
9 write(obj.size);
10 for (const key of obj.keys()) {
11 write(key);
12 }
13 for (const value of obj.values()) {
14 write(value);
15 }
16 }
17 deserialize({ read }) {
18 let size = read();
19 const map = new Map();
20 const keys = [];
21 for (let i = 0; i < size; i++) {
22 keys.push(read());
23 }
24 for (let i = 0; i < size; i++) {
25 map.set(keys[i], read());
26 }
27 return map;
28 }
29}
30
31module.exports = MapObjectSerializer;
Note: See TracBrowser for help on using the repository browser.