mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.
17 lines (13 loc) • 427 B
JavaScript
// Note: This file is used by the file ./index.js
function factory (type, config, load, typed) {
// create a new typed function using MyType
// when imported in math.js, this will extend the
// existing function `add` with support for MyType
return typed('add', {
'MyType, MyType': function (a, b) {
return new type.MyType(a.value + b.value);
}
});
}
exports.name = 'add';
exports.factory = factory;