百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

dinero.js

> 编程语言
开源

在 JavaScript 和 TypeScript 中创建、计算和格式化金额

6.8K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

在 JavaScript 和 TypeScript 中创建、计算和格式化金额


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

--- 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. ## ✨ Features - **Immutable & pure:** every operation returns a new object, no side effects - **Type-safe:** first-class TypeScript support with full type inference - **Tree-shakeable:** import only what you use, keep bundles small - **Pluggable precision:** use `number` by default or `bigint` for large amounts - **Non-decimal currencies:** support for any base, including multi-subdivision currencies - **Framework-agnostic:** works everywhere JavaScript runs ## Install ```sh npm install dinero.js # or yarn add dinero.js ``` ## ⚡️ Quick start `Dinero` objects are minimal. Every function in `dinero.js` is side-effect free, allowing you only to bundle exactly what you use. ```js import { dinero, add, toDecimal } from 'dinero.js'; import { USD } from 'dinero.js/currencies'; const d1 = dinero({ amount: 500, currency: USD }); const d2 = dinero({ amount: 800, currency: USD }); const total = add(d1, d2); toDecimal(total); // "13.00" ``` Check out the [quick start guide](https://dinerojs.com/getting-started/quick-start) on the documentation. ## Documentation The documentation lets you learn about all aspects of the library. - [**Getting started**](https://dinerojs.com/getting-started/quick-start) to get up and running quickly with Dinero.js - [**Core concepts**](https://dinerojs.com/core-concepts/amount) to learn about the underlying principles behind the library - [**Guides**](https://dinerojs.com/guides/precision-and-large-numbers) to dig deeper into specific use cases. - [**API**](https://dinerojs.com/api/mutations/add) for a comprehensive list of available functions and their parameters. - [**FAQ**](https://dinerojs.com/faq/why-no-currency-formatting) for common answers to questions you might have Visit the [full documentation](https://dinerojs.com) to know more. ## Agent Skills If you use AI coding agents (Claude Code, Cursor, GitHub Copilot, etc.), install the [Dinero.js skills](https://github.com/dinerojs/skills) to teach your agent best practices, common pitfalls, and correct usage patterns. ```sh npx skills add dinerojs/skills ``` ## Used by Dinero.js is used by [WooCommerce](https://github.com/woocommerce/woocommerce), [Highlight](https://github.com/highlight/highlight), [Cypress](https://github.com/cypress-io/cypress-realworld-app), [Vercel](https://github.com/vercel/next-app-router-playground), [AWS Labs](https://github.com/awslabs/aws-lambda-web-adapter), [Module Federation](https://github.com/module-federation/core), and [many more](https://github.com/dinerojs/dinero.js/network/dependents). ## Contributors **From v1:** ## License [MIT](LICENSE)

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptamountcurrencyimmutablejavascript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言