UNPKG

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

16 lines (14 loc) 339 B
var resolve = require('resolve'); module.exports = function(cwd, moduleName, register) { var result; try { var modulePath = resolve.sync(moduleName, { basedir: cwd }); result = require(modulePath); if (typeof register === 'function') { register(result); } } catch (e) { result = e; } return result; };