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 🙏

© 2026 – Pkg Stats / Ryan Hefner

korean-currency

v1.0.0

Published

숫자를 한글 금액으로 변환 (12500 → 일만이천오백원)

Readme

korean-currency

숫자를 한글 금액으로 변환하는 라이브러리

12500 → "일만이천오백원"

설치

npm install korean-currency

사용법

ESM / TypeScript

import { toKorean, fromKorean } from 'korean-currency';

toKorean(12500);                      // "일만이천오백원"
toKorean(12500, { suffix: false });   // "일만이천오백"
toKorean(340000000);                  // "삼억사천만원"

fromKorean("일만이천오백원");           // 12500
fromKorean("삼억사천만원");             // 340000000

CommonJS

const { toKorean, fromKorean } = require('korean-currency');

toKorean(12500);  // "일만이천오백원"

API

toKorean(num, options?)

숫자를 한글 금액으로 변환합니다.

| 매개변수 | 타입 | 설명 | |---------|------|------| | num | number | 변환할 숫자 | | options | object | 옵션 (선택) |

Options

| 옵션 | 타입 | 기본값 | 설명 | |-----|------|-------|------| | suffix | boolean | true | "원"을 붙일지 여부 | | unit | boolean | true | 단위(만, 억 등)를 포함할지 여부 |

toKorean(12500);                      // "일만이천오백원"
toKorean(12500, { suffix: false });   // "일만이천오백"
toKorean(0);                          // "영원"
toKorean(-5000);                      // "마이너스 오천원"

fromKorean(korean)

한글 금액을 숫자로 변환합니다.

| 매개변수 | 타입 | 설명 | |---------|------|------| | korean | string | 한글 금액 문자열 |

fromKorean("일만이천오백원");   // 12500
fromKorean("삼억사천만원");     // 340000000
fromKorean("영");              // 0

지원 범위

  • 0부터 해(10^20) 단위까지 지원
  • 음수 지원 ("마이너스 ...")
  • 소수점은 정수 부분만 변환

정밀도 안내

JavaScript의 Number.MAX_SAFE_INTEGER는 약 9천조(9 × 10^15)입니다.

| 단위 | 값 | 상태 | |-----|-----|------| | 조 (10^12) | 1,000,000,000,000 | ✅ 정확 | | 경 (10^16) | 10,000,000,000,000,000 | ⚠️ 정밀도 손실 가능 | | 해 (10^20) | 100,000,000,000,000,000,000 | ⚠️ 정밀도 손실 가능 |

조 단위까지는 100% 정확하며, 경/해 단위는 큰 금액 표시용으로 사용하세요.

에러 처리

잘못된 입력에 대해 에러를 throw합니다.

toKorean

toKorean(NaN);           // TypeError: NaN은 변환할 수 없습니다.
toKorean(Infinity);      // TypeError: Infinity는 변환할 수 없습니다.
toKorean(1e25);          // RangeError: 지원 범위를 초과했습니다.
toKorean("12500");       // TypeError: 숫자가 필요합니다.

fromKorean

fromKorean("");          // TypeError: 빈 문자열은 변환할 수 없습니다.
fromKorean("hello");     // TypeError: 잘못된 문자가 포함되어 있습니다.
fromKorean(12500);       // TypeError: 문자열이 필요합니다.

라이선스

MIT


korean-currency (English)

A library to convert numbers to Korean currency format.

12500 → "일만이천오백원" (approximately: "12,500 won" in Korean)

Installation

npm install korean-currency

Usage

import { toKorean, fromKorean } from 'korean-currency';

toKorean(12500);                      // "일만이천오백원"
toKorean(12500, { suffix: false });   // "일만이천오백"

fromKorean("일만이천오백원");           // 12500

API

toKorean(num, options?)

Converts a number to Korean currency string.

| Parameter | Type | Description | |-----------|------|-------------| | num | number | Number to convert | | options.suffix | boolean | Append "원" (won) suffix (default: true) | | options.unit | boolean | Include units like 만, 억 (default: true) |

fromKorean(korean)

Converts a Korean currency string to number.

| Parameter | Type | Description | |-----------|------|-------------| | korean | string | Korean currency string |

Supported Range

  • Supports 0 to 해 (10^20)
  • Supports negative numbers ("마이너스 ...")
  • Decimals are truncated to integers

Precision Notice

JavaScript's Number.MAX_SAFE_INTEGER is approximately 9 × 10^15.

| Unit | Value | Status | |------|-------|--------| | 조 (trillion) | 10^12 | ✅ Accurate | | 경 (10 quadrillion) | 10^16 | ⚠️ Possible precision loss | | 해 (100 quintillion) | 10^20 | ⚠️ Possible precision loss |

Accurate up to 조 (trillion). Use 경/해 for display purposes only.

Error Handling

Throws errors for invalid inputs:

  • TypeError: Invalid type, NaN, Infinity, empty string, invalid characters
  • RangeError: Number exceeds supported range (> 10^24)

License

MIT