npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

web3number

v1.0.1

Published

The web3number npm package simplifies the handling of numerical values within the web3 environment, offering versatile functionalities for converting web3 BigNumber to human-readable formats with options for thousands separators and decimal precision. It

Downloads

6

Readme

web3number

The web3number npm package simplifies the handling of numerical values within the web3 environment, offering versatile functionalities for converting web3 BigNumber to human-readable formats with options for thousands separators and decimal precision. It also supports rounding down and conversion between BigNumber and ethers wei/ether.

Install

// npm 
npm install web3number --save


// yarn
yarn add web3number

Use

TODO

  • bigNumberify: 将输入的值转换为 ethers.js 的 BigNumber 类型。

  • expandDecimals: 将数值扩展为指定小数位数的整数。

  • getLimitedDisplay: 获取有限的显示信息,根据指定阈值添加符号。

  • trimZeroDecimals: 去掉小数末尾的零。

  • limitDecimals: 限制小数位数。

  • padDecimals: 补足小数位数。

  • formatAmount: 格式化数值,包括小数位数控制、逗号分隔。

  • formatUsd: 格式化 USD 数值,可指定小数位数和阈值。

  • formatDeltaUsd: 格式化 USD 数值的变化,包括百分比。

  • formatPercentage: 格式化百分比。

  • formatTokenAmount: 格式化代币数值,支持显示阈值、千位分隔符等。

  • formatTokenAmountWithUsd: 格式化带 USD 数值的代币数值。

  • parseValue: 解析字符串为 BigNumber。

  • numberWithCommas: 数值添加千位分隔符。

  • roundUpDivision: 向上舍入的除法。

  • applyFactor: 数值乘以因子。

  • getBasisPoints: 计算基点数。

  • basisPointsToFloat: 将基点数转为浮点数。

  • roundToTwoDecimals: 四舍五入到两位小数。

  • sumBigNumbers: 多个 BigNumber 求和。

removeTrailingZeros: 移除字符串尾随的零。

developer

npm version patch
npm version minor
npm version major