source: trip-planner-front/node_modules/webpack/lib/serialization/SingleItemMiddleware.js@ 188ee53

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

initial commit

  • Property mode set to 100644
File size: 806 bytes
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3*/
4
5"use strict";
6
7const SerializerMiddleware = require("./SerializerMiddleware");
8
9/**
10 * @typedef {any} DeserializedType
11 * @typedef {any[]} SerializedType
12 * @extends {SerializerMiddleware<any, any[]>}
13 */
14class SingleItemMiddleware extends SerializerMiddleware {
15 /**
16 * @param {DeserializedType} data data
17 * @param {Object} context context object
18 * @returns {SerializedType|Promise<SerializedType>} serialized data
19 */
20 serialize(data, context) {
21 return [data];
22 }
23
24 /**
25 * @param {SerializedType} data data
26 * @param {Object} context context object
27 * @returns {DeserializedType|Promise<DeserializedType>} deserialized data
28 */
29 deserialize(data, context) {
30 return data[0];
31 }
32}
33
34module.exports = SingleItemMiddleware;
Note: See TracBrowser for help on using the repository browser.