Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bbonkr/bbon-formatter
npm package @bbon/formmater
https://github.com/bbonkr/bbon-formatter
javascript nodejs npm typescript
Last synced: 25 days ago
JSON representation
npm package @bbon/formmater
- Host: GitHub
- URL: https://github.com/bbonkr/bbon-formatter
- Owner: bbonkr
- License: mit
- Created: 2020-04-25T05:54:40.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-06T11:58:52.000Z (over 1 year ago)
- Last Synced: 2024-10-07T21:51:20.105Z (30 days ago)
- Topics: javascript, nodejs, npm, typescript
- Language: TypeScript
- Homepage: http://bbon.me/bbon-formatter
- Size: 5.86 MB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @bbon/formatter
[![](https://shields.io/npm/v/@bbon/formatter)](https://www.npmjs.com/package/@bbon/formatter) [![](https://shields.io/npm/dt/@bbon/formatter)](https://www.npmjs.com/package/@bbon/formatter) [![Build and tag](https://github.com/bbonkr/bbon-formatter/actions/workflows/build-and-tag.yml/badge.svg)](https://github.com/bbonkr/bbon-formatter/actions/workflows/build-and-tag.yml) [![publish NPM](https://github.com/bbonkr/bbon-formatter/actions/workflows/publish-npm.yml/badge.svg)](https://github.com/bbonkr/bbon-formatter/actions/workflows/publish-npm.yml)
값을 형식화된 문자열로 처리하기 위한 기능을 제공합니다.
## 설치 Installation
```sh
$ npm install @bbon/formatter
``````sh
$ yarn add @bbon/formatter
```## 사용 Usage
### numberWithDelimiter
구분자로 구분된 숫자를 출력합니다.
```typescript
import { StringFormatter } from '@bbon/formatter';const formatter = new StringFormatter();
const numberValue = 1000;
const formattedValue = formatter.numberWithDelimiter(numberValue);console.info(formattedValue); // '1,000'
```### fileSize
파일 크기를 읽기 편하게 출력합니다.
```typescript
import { StringFormatter } from '@bbon/formatter';const formatter = new StringFormatter();
const numberValue = 2.05 * 1024;
const formattedValue = formatter.fileSize(numberValue, formatter.formattedValue, ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB']);console.info(formattedValue); // '2.05 KB'
```