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

chinese-amount-to-number

v1.0.0

Published

是一个简单的 JavaScript 库,用于将中文大写的金额转换为数字。它适用于财务应用和其他需要处理中文金额字符串的场景。Convert Chinese amount strings to numbers.

Downloads

67

Readme

chinese-amount-to-number

介绍

是一个简单的 JavaScript 库,用于将中文大写的金额转换为数字。它适用于财务应用和其他需要处理中文金额字符串的场景。

支持的金额表达式

  • 数字: 壹、贰、叁、肆、伍、陆、柒、捌、玖、零
  • 单位: 亿、万、仟、佰、拾、圆、角、分

安装

通过 npm 安装:

npm install chinese-amount-to-number

使用方法

convert(amount: string): number

  • 参数:
    • amount (string): 需要转换的中文金额字符串。
  • 返回:
    • number: 转换后的数字金额。

示例

const convert = require('chinese-amount-to-number');

console.log(convert('伍佰圆整')); // 输出: 500
console.log(convert('叁万肆仟伍佰陆拾柒圆捌角玖分')); // 输出: 34567.89
console.log(convert('捌仟壹佰柒拾叁圆肆角肆分')); // 输出: 8173.44
console.log(convert('捌亿壹仟壹佰柒拾叁圆肆角肆分')); // 输出: 800001173.44

贡献指南

欢迎贡献者提交 issue 和 pull request。请确保遵循现有的代码风格,并添加测试案例来覆盖新的功能或修复。

许可证

本项目遵循 MIT 许可证。更多信息请参见 LICENSE 文件。