MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / parseOEISResponse

Function parseOEISResponse

src/compute-engine/oeis.ts:125–144  ·  view source on GitHub ↗

* Parse OEIS JSON response into OEISSequenceInfo objects.

(data: unknown)

Source from the content-addressed store, hash-verified

123 if (!payload) return [];
124
125 const results = payload.results;
126 if (!Array.isArray(results)) return [];
127
128 return results;
129}
130
131/**
132 * Parse OEIS JSON response into OEISSequenceInfo objects.
133 */
134function parseOEISResponse(data: unknown): OEISSequenceInfo[] {
135 const results = parseResults(data);
136
137 return results.map((result) => {
138 const sequenceNumber = parseSequenceNumber(result.number);
139 const id =
140 sequenceNumber !== undefined
141 ? `A${String(sequenceNumber).padStart(6, '0')}`
142 : '';
143
144 return {
145 id,
146 name: typeof result.name === 'string' ? result.name : '',
147 terms: parseTerms(result.data),

Callers 2

lookupOEISByTermsFunction · 0.85
lookupOEISByIdFunction · 0.85

Calls 6

parseResultsFunction · 0.85
parseSequenceNumberFunction · 0.85
parseTermsFunction · 0.85
parseFormulaFunction · 0.85
parseCommentsFunction · 0.85
mapMethod · 0.65

Tested by

no test coverage detected