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

pixiu-number-toolkit

v3.0.10

Published

A collection of number utilities.

Downloads

494

Readme

pixiu-number-toolkit 文档

pixiu-number-toolkit 是一个用 TypeScript 编写的数字工具集。它提供了一组用于数字转换、财务计算、格式化和数学运算的函数。

安装

要安装 pixiu-number-toolkit,使用以下命令:

npm install pixiu-number-toolkit

功能

基础功能

  • 货币格式化:提供了一套完整的货币处理工具,包括货币格式化、货币字符串到数字的转换以及获取货币的千位分隔符和小数点符号等功能。这些功能基于 Intl.NumberFormat 对象实现,能够适应多种语言环境下的货币显示需求。

  • 数字、大写金额相互转换:提供了将数值金额转换为其汉字大写形式的功能,适用于需要将金额正式表述的财务情境。

  • 数字转中文文字:提供了将数字转换为中文的大写文字形式,适用于需要将数字以中文文字形式展示的场合。

  • 计算数学表达式:提供了计算数学表达式的能力,支持参数化计算、自定义小数位数以及千位分隔符的显示选项,适用于各种数学和财务计算场景。解决 JavaScript 浮点数精度丢失问题

  • 解析中国身份证信息:提供了对中国居民身份证号的解析能力,能够提取出生日期、性别及所属地区信息,并验证身份证号的有效性。这在身份验证、人口统计分析及各类用户信息处理场景中极为有用。

  • 数字过渡动画:用于在给定时间内从一个数值平滑过渡到另一个数值,常用于创建动态计数器、数据可视化中的数值变化等动画效果。

  • 单位转换:功能强大的单位转换函数,旨在帮助开发者轻松进行各种物理量的单位之间的转换。该函数支持长度、重量、面积、体积、速度、温度、压力、功率、电量、电压、电流、时间、角度、数据存储、频率、力及压强等多种单位类型的转换,并允许用户选择是否在返回的结果中保留单位标识。

  • 工具函数

    • 复杂公式的计算:对于需要执行高级数学计算的场景,推荐使用计算表达式功能。
    • 数据分析与统计:模块中的概率运算函数非常适合进行随机抽样或生成随机数,适用于数据分析及模拟实验。
    • 数据比较:关系运算函数帮助快速判断数值大小,适用于条件判断和排序算法。
    • 分析和操作数字的整数、小数部分。
  • 常用正则:一系列预定义的正则表达式,用于验证和匹配各种数据类型和格式,旨在简化前端和后端的数据验证流程。无论是基本的数字、字符串验证,还是复杂的身份证、车牌号识别,这些正则表达式都能提供强大的支持。

  • 校验函数: 提供一系列常用的校验函数,用于验证各种数据类型和格式,旨在简化前端和后端的数据验证流程。无论是基本的数字、字符串验证,还是复杂的身份证、车牌号识别,这些校验函数都能提供强大的支持。