* 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)
| 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. |