Add MathNode.content optional property (#43435)

This is used by ParenthesisNode
This commit is contained in:
Mark Wiemer 2020-04-02 12:22:02 -05:00 committed by GitHub
parent 170c6b25ea
commit afa55fd87e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -2,9 +2,10 @@
// Project: https://mathjs.org/
// Definitions by: Ilya Shestakov <https://github.com/siavol>,
// Andy Patterson <https://github.com/andnp>,
// Brad Besserman <https://github.com/bradbesserman>
// Pawel Krol <https://github.com/pawkrol>
// Charlee Li <https://github.com/charlee>
// Brad Besserman <https://github.com/bradbesserman>,
// Pawel Krol <https://github.com/pawkrol>,
// Charlee Li <https://github.com/charlee>,
// Mark Wiemer <https://github.com/mark-wiemer>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@ -3072,6 +3073,7 @@ declare namespace math {
isSymbolNode?: boolean;
isUpdateNode?: boolean;
comment?: string;
content?: MathNode;
op?: string;
fn?: string;
args?: MathNode[];

View File

@ -153,6 +153,12 @@ Expressions examples
math.evaluate(['f = 3', 'g = 4', 'f * g']);
}
// get content of a parenthesis node
{
const node = math.parse('(1)');
const innerNode = node.content;
}
// scope can contain both variables and functions
{
const scope = { hello: (name: string) => `hello, ${name}!` };