MCPcopy Index your code
hub / github.com/ethereum/node-crawler / parse

Function parse

frontend/src/data/DataProcessor.ts:202–239  ·  view source on GitHub ↗
(item: ClientApiResponse)

Source from the content-addressed store, hash-verified

200 let primaryKey = 0
201
202 const parse = (item: ClientApiResponse): Client | undefined => {
203 primaryKey++;
204 const clientId = item.clientId.toLowerCase()
205 if (!clientId) {
206 errorCallback('parse', 'empty client id', '');
207 return undefined;
208 }
209
210 const matches = clientId.match(/(?<name>\w+)\/(?<raw>.+)/);
211 if (matches?.groups) {
212 const raw = parseRaw(clientId, { primaryKey, errorCallback: (entity, data, pk) => {
213 errorCallback(entity, data, `${pk}: "${clientId}"`)
214 }, raw: clientId });
215 if (!raw) {
216 return undefined;
217 }
218
219 if (raw.runtime) {
220 const runtimeName = raw.runtime.name || 'Unknown'
221 topRuntimes.set(runtimeName, (topRuntimes.get(runtimeName) || 0) + item.count)
222 }
223
224 if (raw.os) {
225 const osName = raw.os.vendor || 'Unknown'
226 topOs.set(osName, (topOs.get(osName) || 0) + item.count)
227 }
228
229 return {
230 primaryKey,
231 name: matches.groups.name,
232 count: item.count,
233 ...raw,
234 };
235 }
236
237 errorCallback('parse', item.clientId, '');
238 return undefined;
239 };
240
241 const matchesFilters = (client: Client, filters?: Filter[]): boolean => {
242 if (!filters || !filters.length) {

Callers 1

ClientsProcessorFunction · 0.85

Calls 3

parseRawFunction · 0.85
setMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected