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 🙏

© 2026 – Pkg Stats / Ryan Hefner

money_zonki

v1.0.3

Published

增加大数值单位功能

Readme

简介

进行货币单位转换及格式化 例如: 1000000分 => 10,000.00元 可扩展不同货币转化及不同计量单位的转化

注:目前仅支持人民币转化

upinfo: 2022-11-24 增加大数值单位转换功能,10000->1万

安装

npm i money_zonki

demo

// node环境
var money_factory = require("money_zonki");

var money = money_factory({
    value: "200000",
    unit: "fen"
});

var convert_r = money.convert({
    tUnit: "yuan"
});
console.log(convert_r);//2000

var format_r = money.format({
    format: "0,0.00"
});
console.log(format_r);//200,000.00

var bigValueRes = money.converBigValue({
    bigUnits: [{
        value: 10000,
        text: "万"
    },{
       value: 100000000,
       text: "亿"
    }]
})
console.log(bigValueRes);//{ value: 20, text: '万' }

方法说明

money_factory

模块导出的工厂类,必传js对象为参数,返回money实例,以下为对象属性说明

| 属性 | 说明 | 必传 | 类型 | 备注 | | ---- | ---- | ---- | ---- | ---- | | category | 货币种类 | false | string | 目前可传"RMB",默认也为"RMB" | | value | 货币值 | false | string/number | 比如"100000",默认为0 | | unit | 货币单位 |false | string | 目前可传"yuan""jiao""fen",默认为"yuan" |

convert

money实例方法,必传js对象为参数,返回货币单位转换后的字符串,以下为对象属性说明

| 属性 | 说明 | 必传 | 类型 | 备注 | | ---- | ---- | ---- | ---- | ---- | | value | 转化前的值 | false | string/number | 默认为初始化实例的value值 | | rUnit | 原单位 | false | string | 目前可传"yuan""jiao""fen",默认为初始化实例的unit值 | | tUnit | 目标单位 |false | string | 目前可传"yuan""jiao""fen",默认为初始化实例的unit值 |

format

money实例方法,必传js对象为参数,返回货币格式化后的字符串,以下为对象属性说明

| 属性 | 说明 | 必传 | 类型 | 备注 | | ---- | ---- | ---- | ---- | ---- | | value | 格式化前的值 | false | string/number | 默认为初始化实例的value值 | | format | 格式参数 | false | string | "0,0.00",逗号为是否添加千位分隔符的switch,不添加千位分隔符可传"00.00";小数点后0的个数代表保留小数的位数 |

converBigValue

money实例方法,必传js对象为参数,返回大数值添加单位结果对象,以下为输入对象属性说明

| 属性 | 说明 | 必传 | 类型 | 备注 | | ---- | ---- | ---- | ---- | ---- | | value | 转化前的值 | false | string/number | 默认为初始化实例的value值 | | bigUnits | 所要转化的单位列表 | false | array | 默认为[{value: 100000000,text: "亿"},{value: 10000,text: "万"}]|

以下为输出对象属性说明

| 属性 | 说明 | 类型 |
| ---- | ---- | ---- | | value | 转化后的值 | number | | text | 单位 | string |