johnhooks / dinero

A port of dinero.js by sarahdayan to a Deno module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dinero

This repository is a port of the awesome Dinero.js package by Sarah Dayan to a Deno module

Dinero lets you create, calculate, and format money safely in Deno.


Money is complex, and the primitives of the language aren't enough to properly represent it. Dinero is a Deno 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.

⚡️ Quick start

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

import { USD } from "https://raw.githubusercontent.com/johnhooks/dinero/v2.0.0-alpha.10/currencies.ts";
import {
  add,
  dinero,
} from "https://raw.githubusercontent.com/johnhooks/dinero/v2.0.0-alpha.10/mod.ts'";

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

add(d1, d2);

About

A port of dinero.js by sarahdayan to a Deno module

License:MIT License


Languages

Language:TypeScript 100.0%