These packages aim to provide developers with a set of commonly used functions and features for building web applications, such as handling big numbers, date manipulation, subscribing to and receiving notifications when certain events occur with EventEmitter, and more.
yarn add @distributedlab/tools
BN uses 26 (yoctoNEAR + 2 (percent precision)) maximum precision by default.
You can change it by BN.setConfig
method.
import { BN } from '@distributedlab/tools';
const amountA = BN.fromRaw(2, 18)
const amountB = BN.fromRaw(3, 18)
console.log(amountA.add(amountB).format({
decimals: 18,
decimalSeparator: '.',
groupSeparator: ',',
groupSize: 3,
}))
import { time } from '@distributedlab/tools';
const currentDate = time()
console.log(currentDate.format('YYYY-MM-DD'))
yarn test
This project is licensed under the MIT License - see the LICENSE.md file for details
Generated using TypeDoc