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

Function keyValuePair

src/math-json/utils.ts:202–214  ·  view source on GitHub ↗
(
  expr: MathJsonExpression | null | undefined
)

Source from the content-addressed store, hash-verified

200}
201
202function keyValuePair(
203 expr: MathJsonExpression | null | undefined
204): null | [key: string, value: MathJsonExpression] {
205 const h = operator(expr);
206 if (h === 'KeyValuePair' || h === 'Tuple' || h === 'Pair') {
207 const [k, v] = operands(expr);
208 const key = stringValue(k);
209 if (!key) return null;
210 return [key, v ?? 'Nothing'];
211 }
212
213 return null;
214}
215
216// Parse the expression either as:
217// - a `Dictionary` expression

Callers 1

dictionaryFromExpressionFunction · 0.85

Calls 3

operandsFunction · 0.85
stringValueFunction · 0.85
operatorFunction · 0.70

Tested by

no test coverage detected