source: imaps-frontend/node_modules/webpack-merge/dist/unique.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.8 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, pack) {
19 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20 if (ar || !(i in from)) {
21 if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22 ar[i] = from[i];
23 }
24 }
25 return to.concat(ar || Array.prototype.slice.call(from));
26};
27Object.defineProperty(exports, "__esModule", { value: true });
28function mergeUnique(key, uniques, getter) {
29 var uniquesSet = new Set(uniques);
30 return function (a, b, k) {
31 return k === key &&
32 Array.from(__spreadArray(__spreadArray([], __read(a), false), __read(b), false).map(function (it) { return ({ key: getter(it), value: it }); })
33 .map(function (_a) {
34 var key = _a.key, value = _a.value;
35 return ({
36 key: uniquesSet.has(key) ? key : value,
37 value: value,
38 });
39 })
40 .reduce(function (m, _a) {
41 var key = _a.key, value = _a.value;
42 m.delete(key); // This is required to preserve backward compatible order of elements after a merge.
43 return m.set(key, value);
44 }, new Map())
45 .values());
46 };
47}
48exports.default = mergeUnique;
49//# sourceMappingURL=unique.js.map
Note: See TracBrowser for help on using the repository browser.