MCPcopy Create free account
hub / github.com/pmndrs/leva / getSymbols

Function getSymbols

packages/plugin-plot/src/plot-utils.ts:3–17  ·  view source on GitHub ↗
(expr: math.MathNode)

Source from the content-addressed store, hash-verified

1import * as math from 'mathjs'
2
3export function getSymbols(expr: math.MathNode) {
4 return expr
5 .filter((node) => {
6 if (node instanceof math.SymbolNode && node.isSymbolNode) {
7 try {
8 const e = node.evaluate()
9 return !!e.units
10 } catch {
11 return node.name !== 'x'
12 }
13 }
14 return false
15 })
16 .map((node: unknown) => (node as math.SymbolNode).name)
17}
18
19export function parseExpression(expression: string, get: (path: string) => any) {
20 const parsed = math.parse(expression)

Callers 1

parseExpressionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…