MCPcopy
hub / github.com/ollm/OpenComic / get

Function get

scripts/relative.js:84–153  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

82const cacheResolved = new Map();
83
84function get(key)
85{
86 const resolved = cacheResolved.get(key);
87
88 if(resolved && resolved.lastUpdate === storage.lastUpdate(key))
89 return resolved.data;
90
91 const data = storage.get(key);
92 let resolvedData = data;
93
94 switch (key)
95 {
96 case 'masterFolders':
97
98 resolvedData = data.map(function(path) {
99
100 return resolve(path);
101
102 });
103
104 break;
105
106 case 'comics':
107
108 resolvedData = data.map(function(data) {
109
110 return {
111 ...data,
112 path: resolve(data.path),
113 };
114
115 });
116
117 break;
118
119 case 'favorites':
120 case 'comicLabels':
121 case 'bookmarks':
122
123 resolvedData = {};
124
125 for(let path in data)
126 {
127 resolvedData[resolve(path)] = data[path];
128 }
129
130 break;
131
132 case 'readingProgress':
133
134 resolvedData = {};
135
136 for(let path in data)
137 {
138 resolvedData[resolve(path)] = {
139 ...data[path],
140 path: resolve(data[path].path),
141 };

Callers

nothing calls this directly

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected