Replies: 4 comments
-
I don’t expose those methods. I try to keep the methods exposed to mostly those required by ethers or that are otherwise very common. |
Beta Was this translation helpful? Give feedback.
-
Aren't min/max methods quite common? |
Beta Was this translation helpful? Give feedback.
-
They aren't uncommon, but I find the ternary and map-reduce solutions generally more flexible, for example: // Max of two values:
const maxValue1 = v1.gt(v2) ? v1: v2;
// Max of an array of values
const maxValue = someArray.reduce((a, i) => (a.gt(i) ? a: i), constants.Zero); It's actually fewer bytes to write those than using If it is something lots of people need, I don't mind adding it, but I also don't just want to replicate all the features of a more fully fleshed out BigNumber library; mostly just focus on the parts that Ethereum dives use frequently, and allow them to pull in more complex libraries when needed (for example, I don't plan to add sine, log, gcd, etc.). This helps keep the library lean, and makes upgrading easier (since once a feature is added, it cannot be easily removed). Does that make sense? |
Beta Was this translation helpful? Give feedback.
-
I find |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How do I get access to utils like
BN.max
,BN.min
from@ethersproject/bignumber
Beta Was this translation helpful? Give feedback.
All reactions