MCPcopy
hub / github.com/webpack/webpack / serialize

Method serialize

lib/serialization/MapObjectSerializer.js:14–22  ·  view source on GitHub ↗

* Serializes this instance into the provided serializer context. * @template K, V * @param {Map<K, V>} obj map * @param {import("./ObjectMiddleware").ObjectSerializerContext<(number | K | V)[]>} context context

(obj, context)

Source from the content-addressed store, hash-verified

12 * @param {import("./ObjectMiddleware").ObjectSerializerContext<(number | K | V)[]>} context context
13 */
14 serialize(obj, context) {
15 context.write(obj.size);
16 for (const key of obj.keys()) {
17 context.write(key);
18 }
19 for (const value of obj.values()) {
20 context.write(value);
21 }
22 }
23
24 /**
25 * Restores this instance from the provided deserializer context.

Callers

nothing calls this directly

Calls 3

writeMethod · 0.80
keysMethod · 0.65
valuesMethod · 0.45

Tested by

no test coverage detected