MCPcopy
hub / github.com/josdejong/mathjs / MathNode

Interface MathNode

types/index.d.ts:4616–4779  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4614}
4615
4616export interface MathNode {
4617 isNode: true
4618 comment: string
4619 type: string
4620
4621 isUpdateNode?: boolean
4622
4623 /**
4624 * Create a shallow clone of the node. The node itself is cloned, its
4625 * childs are not cloned.
4626 */
4627 clone(): this
4628 /**
4629 * Create a deep clone of the node. Both the node as well as all its
4630 * childs are cloned recursively.
4631 */
4632 cloneDeep(): this
4633 /**
4634 * Compile an expression into optimized JavaScript code. compile returns
4635 * an object with a function evaluate([scope]) to evaluate. Example:
4636 */
4637 compile(): EvalFunction
4638 /**
4639 * Compile and eval an expression, this is the equivalent of doing
4640 * node.compile().evaluate(scope). Example:
4641 */
4642 // eslint-disable-next-line @typescript-eslint/no-explicit-any
4643 evaluate(scope?: MathScope): any
4644 /**
4645 * Test whether this node equals an other node. Does a deep comparison
4646 * of the values of both nodes.
4647 */
4648 equals(other: MathNode): boolean
4649 /**
4650 *
4651 * Filter nodes in an expression tree. The callback function is called
4652 * as callback(node: MathNode, path: string, parent: MathNode) : boolean
4653 * for every node in the tree, and must return a boolean. The function
4654 * filter returns an array with nodes for which the test returned true.
4655 * Parameter path is a string containing a relative JSON Path.
4656 *
4657 * Example:
4658 *
4659 * ```
4660 * var node = math.parse('x^2 + x/4 + 3*y');
4661 * var filtered = node.filter(function (node) {
4662 * return node.isSymbolMathNode && node.name == 'x';
4663 * });
4664 * // returns an array with two entries: two SymbolMathNodes 'x'
4665 * ```
4666 *
4667 * The callback function is called as callback(node: MathNode, path:
4668 * string, parent: MathNode) : boolean for every node in the tree, and
4669 * must return a boolean. The function filter returns an array with
4670 * nodes for which the test returned true. Parameter path is a string
4671 * containing a relative JSON Path.
4672 * @return Returns an array with nodes for which test returned true
4673 */

Callers 51

Node.test.jsFile · 0.65
testTypes.tsFile · 0.65
expandPowerFunction · 0.65
cloneDeepMethod · 0.65
entryGenerator.jsFile · 0.65
parse.test.jsFile · 0.65
parse.test.jsFile · 0.65
compile.test.jsFile · 0.65
SymbolNode.test.jsFile · 0.65
ObjectNode.test.jsFile · 0.65

Implementers 1

Nodesrc/expression/node/Node.js

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…