-
I'd just need the definition for Greatest Common Divisor. Is it possible to install a submodule of MathJS? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
Yes, if you're using ES6 imports you can just import the functions you need. The regular functions like the following are relatively large since they include BigNumber, Matrix, etc: import { gcd } from 'mathjs' If you only need a import { gcd } from 'mathjs/number' For more info see: https://mathjs.org/docs/getting_started.html |
Beta Was this translation helpful? Give feedback.
-
Thank you @josdejong. I forgot to mention I'm using this in Node, so I was looking for something like a partial installation —like |
Beta Was this translation helpful? Give feedback.
-
No, not really, though you can look in Just curious: if you're using node.js, a larger file is normally not an issue like in the browser where bundles must be as small as possible. Why are you concerned with loading a small file only? |
Beta Was this translation helpful? Give feedback.
-
@josdejong my use case is lambda functions, so creating the smallest bundles is beneficial for speed |
Beta Was this translation helpful? Give feedback.
-
Yes that makes sense Nick 👍 |
Beta Was this translation helpful? Give feedback.
-
In my case I'm building a mobile app using Temenos (formerly Kony) Quantum and I'm just abusing NPM to install dependencies. So also, the smaller the codebase the better. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your feedback Miguelángel. For web and mobile, the bundle size matters a lot indeed, only for nodejs (server side) it's less important. |
Beta Was this translation helpful? Give feedback.
Yes, if you're using ES6 imports you can just import the functions you need. The regular functions like the following are relatively large since they include BigNumber, Matrix, etc:
If you only need a
number
implementation I think the following will work for you:For more info see:
https://mathjs.org/docs/getting_started.html
https://mathjs.org/docs/custom_bundling.html