source: trip-planner-front/node_modules/webpack-merge/dist/unique.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: 1.5 KB
Line 
1"use strict";
2var __read = (this && this.__read) || function (o, n) {
3 var m = typeof Symbol === "function" && o[Symbol.iterator];
4 if (!m) return o;
5 var i = m.call(o), r, ar = [], e;
6 try {
7 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8 }
9 catch (error) { e = { error: error }; }
10 finally {
11 try {
12 if (r && !r.done && (m = i["return"])) m.call(i);
13 }
14 finally { if (e) throw e.error; }
15 }
16 return ar;
17};
18var __spreadArray = (this && this.__spreadArray) || function (to, from) {
19 for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
20 to[j] = from[i];
21 return to;
22};
23exports.__esModule = true;
24function mergeUnique(key, uniques, getter) {
25 var uniquesSet = new Set(uniques);
26 return function (a, b, k) {
27 return (k === key) && Array.from(__spreadArray(__spreadArray([], __read(a)), __read(b)).map(function (it) { return ({ key: getter(it), value: it }); })
28 .map(function (_a) {
29 var key = _a.key, value = _a.value;
30 return ({ key: (uniquesSet.has(key) ? key : value), value: value });
31 })
32 .reduce(function (m, _a) {
33 var key = _a.key, value = _a.value;
34 m["delete"](key); // This is required to preserve backward compatible order of elements after a merge.
35 return m.set(key, value);
36 }, new Map())
37 .values());
38 };
39}
40exports["default"] = mergeUnique;
41//# sourceMappingURL=unique.js.map
Note: See TracBrowser for help on using the repository browser.