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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ekasrupiah

v1.0.11

Published

Mengkonversi angka ke dalam format penulisan mata uang rupiah

Downloads

20

Readme

ekasrupiah NPM Version Minified Size NPM Downloads

Mengkonversi angka ke dalam format penulisan mata uang rupiah

Demo

Link Demo

Instalasi dan Penggunaan

npm install ekasrupiah
import toRupiah from 'ekasrupiah';

Usage

console.log(toRupiah(50000));
// Output: Rp50.000,00
console.log(toRupiah(50000, {symbol: 'IDR', floatingPoint: 0}));
// Output: 50.000 IDR

Fitur

Mendukung berbagai format penulisan mata uang rupiah, baik formal maupun informal.

Parameter fungsi yang tersedia

|Key|Value|Default|Description| |:--|:-:|:-:|:--| |symbol|string|Rp|Simbol mata uang yang digunakan. Tersedia Rp dan IDR. Gunakan null untuk menghilangkan simbol.| |formal|boolean|true|Menentukan posisi simbol mata uang, di depan atau di belakang nominal menurut kaidah Bahasa Indonesia.| |dot|string|.|Simbol pengganti tanda titik "." pada hasil format| |decimal|string|,|Simbol pengganti tanda koma "," pada hasil format| |floatingPoint|number|2|Menentukan jumlah angka di belakang koma| |replaceZeroDecimals|boolean|false|Opsi untuk menukar bilangan angka di belakang koma yang berisi nol semua dengan ",-"| |useUnit|boolean|false|Opsi untuk memasang satuan unit (rb, jt, M, T) untuk angka ribuan, jutaan, sampai triliun| |k|boolean|false|Opsi untuk mengganti satuan unit ribuan dengan simbol "k"| |longUnit|boolean|false|Memanjangkan singkatan dari satuan unit kembali ke kata asalnya| |spaceBeforeUnit|boolean|false|Memberikan jarak satu spasi antara nominal dan unit|

Contoh penggunaan parameter fungsi

console.log(toRupiah(50000));
// Output: Rp50.000,00
console.log(toRupiah(50000, {symbol: 'IDR'}));
// Output: 50.000,00 IDR
console.log(toRupiah(50000, {formal: false}));
// Output: Rp 50.000,00
console.log(toRupiah(50000, {formal: false, symbol: 'IDR'}));
// Output: IDR 50.000,00
console.log(toRupiah(50000, {dot: ',', floatingPoint: 0}));
// Output: Rp 50,000
console.log(toRupiah(50000, {dot: ',', decimal: '.'}));
// Output: Rp 50,000.00
console.log(toRupiah(50000, {replaceZeroDecimals: true}));
// Output: Rp50.000,-
console.log(toRupiah(50000, {useUnit: true, floatingPoint: 0}));
// Output: Rp50rb
console.log(toRupiah(50000, {symbol: 'IDR', formal: false, useUnit: true, k: true, floatingPoint: 0}));
// Output: IDR 50k
console.log(toRupiah(50000, {symbol: false, useUnit: true, longUnit: true, spaceBeforeUnit: true, floatingPoint: 0}));
// Output: 50 ribu
console.log(toRupiah(50750000000, {useUnit: true, longUnit: true, spaceBeforeUnit: true, formal: false}));
// Output: Rp 50,75 milyar
console.log(toRupiah(5250, {useUnit: true, symbol: null, k: true}));
// Output: 5,25k

Testing

Testing menggunakan jest. Lihat file tests.

npm install
npm run test

Development

Edit index.js kemudian jalankan perintah:

npm run build