Extending the plugin

Add functions & variables!

Parsify uses math.js parser, so you can easily add and modify variables and functions.

In order to gain access to the parser, use it as the first argument:

export default parser => async expression => {
// ...

If you are using TypeScript, install @parsify/math as a devDependency and import the Parser interface.

You can then use the parser according to the math.js documentation:

// Set a new variable
parser.set('myVariable', 500);
// Create a function
parser.set('hello', name => {
return `hello, ${name}!`;
Remove all functions & variables
NOTE: this will not only remove things created by your plugin, so use it carefully.