mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif
13 lines (9 loc) • 383 B
JavaScript
const math = require('../../../index')
// import the new type MyType and the function `add` in math.js
math.import(require('./MyType'))
math.import(require('./myAdd'))
// create a shortcut to the new type.
const MyType = math.type.MyType
// use the new type
const ans = math.add(new MyType(2), new MyType(3)) // returns MyType(5)
console.log(ans.toString()) // outputs 'MyType:5'