MCPcopy Index your code
hub / github.com/MALSync/MALSync / mapToArray

Function mapToArray

src/utils/syncHandler.ts:48–72  ·  view source on GitHub ↗
(provierList, resultList, masterM = false)

Source from the content-addressed store, hash-verified

46}
47
48export function mapToArray(provierList, resultList, masterM = false) {
49 for (let i = 0; i < provierList.length; i++) {
50 const el = provierList[i];
51 let temp = resultList[el.malId];
52 if (typeof temp === 'undefined') {
53 temp = {
54 diff: false,
55 master: {},
56 slaves: [],
57 };
58 }
59
60 if (masterM) {
61 temp.master = el;
62 } else {
63 el.diff = {};
64 temp.slaves.push(el);
65 }
66 if (!Number.isNaN(el.malId) && el.malId) {
67 resultList[el.malId] = temp;
68 } else {
69 // TODO: List them
70 }
71 }
72}
73
74export function shouldCheckDates(item) {
75 return ['MAL', 'ANILIST', 'KITSU', 'MANGABAKA'].includes(getType(item.url));

Callers 1

generateSyncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected