rupiah_ts

Simple and lightweight rupiah currency format written in TypeScript

https://github.com/andriawan/rupiah_ts

README.md

mod_test.ts

rupiah.ts

Rupiah

Indonesian Currency (format number to indonesian currency) based on Standart PUEBI format

Installation in Deno

import Rupiah from 'https://deno.land/x/rupiah_ts/rupiah.ts'

let rupiah = new Rupiah(350000);
console.log(rupiah.format);
// result Rp350.000,00

Terbilang

You can also make number to terbilang (words version of rupiah)

import Rupiah from 'https://deno.land/x/rupiah_ts/rupiah.ts'

let rupiah = new Rupiah(350000);
console.log(rupiah.terbilang);
// result Tiga Ratus Lima Puluh Ribu Rupiah

Set Prefix and Suffix

Default prefix is configured as Rp and suffix is configured as ,00 you can set custom prefix and suffix with this following API

import Rupiah from 'https://deno.land/x/rupiah/rupiah.ts'

let rupiah = new Rupiah(350000);
rupiah.setPrefix = "RP";
rupiah.setSuffix = ",-";
console.log(rupiah.format);
// result Rp350.000,-

Separator

Default separator is configured as . you can set custom separator with this following API

import Rupiah from 'https://deno.land/x/rupiah/rupiah.ts'

let rupiah = new Rupiah(350000);
rupiah.setSeparator = "-";
console.log(rupiah.format);
// result 350-000

Development

This repo is in early development stage. PRs is welcomed.

Test

Just run from cli

deno test

Feature Roadmap

  • Rupiah Format
  • Terbilang

Miscellaneous