Socket
Book a DemoInstallSign in
Socket

@distributedlab/tools

Package Overview
Dependencies
Maintainers
5
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@distributedlab/tools

Collection of common utility functions and classes

1.0.0-rc.17
latest
Source
npmnpm
Version published
Weekly downloads
250
309.84%
Maintainers
5
Weekly downloads
 
Created
Source

@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

FAQs

Package last updated on 26 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.