npm 中文文档 npm 中文文档
指南
npmjs.com (opens new window)
指南
npmjs.com (opens new window)
  • 快速入门

    • npm 是什么?
    • npm 安装和更新
    • npm 防止权限错误
    • npm package.json 文件
    • npm 安装包
    • npm 更新包
    • npm 卸载包
    • npm 创建 Node.js 模块
    • npm 发布和更新包
    • npm 使用语义化版本
    • npm 使用 Dist-tags 标记包
    • npm 包和模块的了解
  • 命令行
  • 配置 npm

Dinero.js lets you create, calculate, and format money safely in JavaScript and TypeScript.v2.dinerojs.com/docs

Money is complex, and the primitives of the language aren't enough to properly represent it. Dinero.js is a JavaScript library that lets you express monetary values, but also perform mutations, conversions, comparisons, formatting, and overall make money manipulation easier and safer in your application.

ℹ️Dinero.js v2 is currently in alpha. For v1, check the v1 branch and docs.


📦 Install


  1. ``` shell
  2. npm install dinero.js@alpha

  3. # or

  4. yarn add dinero.js@alpha
  5. ```

⚡️ Quick start


Dinero objects are minimal. Every function in dinero.js is side-effect free, allowing you only to bundle exactly what you use.

  1. ``` js
  2. import { USD } from '@dinero.js/currencies';
  3. import { dinero, add } from 'dinero.js';

  4. const d1 = dinero({ amount: 500, currency: USD });
  5. const d2 = dinero({ amount: 800, currency: USD });

  6. add(d1, d2);
  7. ```

Check out the quick start guide on the documentation.

📚 Documentation


The documentation lets you learn about all aspects of the library.

Getting started to get up and running quickly with Dinero.js
Core concepts to learn about the underlying principles behind the library
Guides to dig deeper into specific use cases.
API for a comprehensive list of available functions and their parameters.
FAQ for common answers to questions you might have

Visit the full documentation to know more.

👥 Contributors


From v1

:--- :--- :--- :--- :--- :---

📜 License


MIT

Powered by Vercel
Last Updated: 2023-05-15 10:22:02