New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mathjs-translate

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mathjs-translate

Utilities for manipulation of mathjs expressions.

latest
Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

Autotests GitHub npm GitHub license

mathjs-translate

Utilities for manipulation of mathjs http://mathjs.org/ expressions.

Installation

npm install mathjs-translate

Usage

const math = require('mathjs');
math.import(require('mathsjs-translate'));

// translations
let matlabExpr = math
    .parse('min(x1,x2,x3) + log(x,b)')
    .translate(math.expression.translate.to.matlab)
    .toString();
console.log(matlabExpr);
// min([x1, x2, x3]) + log(x) / log(b)

// get
let functions = math
    .parse('min(x1,x2,x3) + log(x,b)')
    .getFunctions();
console.log(functions);
// ['min', 'log']

Browser

Browser version located in /dist

Structure of translator

let translator = {
    functionName: {
        exp: "exp1", // change name
        log: function(expression){ // change by function
            ...
            return node;
        }
    },
    symbolName: {
        x: "x1", // change name
        y: function(expression){ // change by function
            ...
            return node;
        }
    },
    operatorName: {
        pow: "pow1", // change name
        add: function(expression){ // change by function
            ...
            return node;
        }
    },
    constant: function(expression){ // change by function
        ...
        return node;
    },
    conditionalType: {
        larger: function(expression){ // change by function
            ...
            return node;
        }
    }
};

Author

  • Evgeny Metelkin @metelkin

InSysBio, Moscow, 2017-2021 http://insysbio.com

Keywords

expression

FAQs

Package last updated on 14 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts