@distributedlab/tools
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-rc.17 • Public • Published

@distributedlab/tools

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.

version (scoped package) types tree-shaking checks

Getting Started

Installing

yarn add @distributedlab/tools

Work with big numbers

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,
}))

Work with dates

import { time } from '@distributedlab/tools';

const currentDate = time()

console.log(currentDate.format('YYYY-MM-DD'))

Running the tests

yarn test

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Readme

Keywords

none

Package Sidebar

Install

npm i @distributedlab/tools

Weekly Downloads

105

Version

1.0.0-rc.17

License

MIT

Unpacked Size

297 kB

Total Files

96

Last publish

Collaborators

  • idovgopoly
  • arvolear
  • artsuslov
  • napalmpapalam
  • volendi