Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/green-labs/rescript-korean-numeral
한글 숫자로 변환해주는 리스크립트 모듈
https://github.com/green-labs/rescript-korean-numeral
Last synced: 24 days ago
JSON representation
한글 숫자로 변환해주는 리스크립트 모듈
- Host: GitHub
- URL: https://github.com/green-labs/rescript-korean-numeral
- Owner: green-labs
- License: mit
- Created: 2021-02-02T23:51:13.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-28T08:28:10.000Z (10 months ago)
- Last Synced: 2024-05-18T20:48:48.607Z (9 months ago)
- Language: ReScript
- Homepage:
- Size: 69.3 KB
- Stars: 7
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-hangul - re-korean-numeral - 한글 숫자로 변환해주는 리스크립트/ReasonML 모듈 (Programming Languages / ReScript/ReasonML)
README
# rescript-korean-numeral
[![npm version](https://img.shields.io/npm/v/@greenlabs/rescript-korean-numeral.svg)](https://www.npmjs.com/package/@greenlabs/rescript-korean-numeral)
> `@greenlabs/re-korean-numeral`은 deprecated 되었습니다.
> 새로운 패키지명 `@greenlabs/rescript-korean-numeral`을 이용해서 설치해주세요.`rescript-korean-numeral`은 숫자를 한글 숫자로 변환해주는 리스트립트(ReScript) 모듈 입니다.
### 예
```
1234 -> 1,234
1234567890 -> 12억 3,456만 7,890
1234567890 -> 12억 3,456만 // 만 이하 절삭
```### ReScript 버전 별 호환성
| ReScript | korean-numeral |
| ---------------------- | -------------- |
| >= v12 | >= v0.5.0 |
| >= v11.1 (BigInt 지원) | >= v0.4.0 |
| ~< v11.1 | ~< v0.4.0 |## 설치하기
1. 모듈 설치
```shell
npm i @greenlabs/rescript-korean-numeral
or
yarn add @greenlabs/rescript-korean-numeral
```2. `rescript.json` 의존성 추가하기
```json
"bs-dependencies": [
"@greenlabs/rescript-korean-numeral"
]
```## 사용방법
1. `fromInt`
```rescript
KoreanNumeric.fromInt(1234, ())
// 1,234
```2. `fromFloat`
```rescript
KoreanNumeric.fromFloat(1234567890.1, ~drop=1, ())
// 12억 3,456만
```3. `fromString`
```rescript
KoreanNumeric.fromString("1234567890987654321", ~drop=1, ())
// 123경 4,567조 8,909억 8,765만
```4. `fromBigInt`
> ReScript v11.1.0-rc.6 부터 지원 가능
```rescript
KoreanNumeric.fromBigInt(1234567890987654321n, ~drop=1, ())
// 123경 4,567조 8,909억 8,765만
```## 테스트
```shell
pnpm test
```