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

@jofu/number-to-words

v0.0.8

Published

Convert numbers to words in Vietnamese, English and Chinese

Readme

🌐 This documentation is available in: 🇬🇧 English | 🇻🇳 Vietnamese | 🇨🇳 Chinese

@jofu/number-to-words

The @jofu/number-to-words library provides a reliable and flexible solution for converting numbers into words in Vietnamese, English, and Chinese. It supports converting integers, decimals, and negative numbers, with configuration options to control the formatting of decimal places and thousand separators for all three languages.

Installation

You can install the library via npm or yarn:

npm install @jofu/number-to-words

Or:

yarn add @jofu/number-to-words

Usage Guide

Vietnamese

To convert an integer into words in Vietnamese, simply call the toWords.vi function with the number you wish to convert and (optionally) the configuration parameters:

import { toWords } from '@jofu/number-to-words';

const result = toWords.vi(1234567);
console.log(result); // "một triệu hai trăm ba mươi bốn nghìn năm trăm sáu mươi bảy"

English

To convert an integer into words in English, call the toWords.en function with the number to be converted and (optionally) the configuration parameters:

import { toWords } from '@jofu/number-to-words';

const result = toWords.en(1234567);
console.log(result); // "one million two hundred thirty-four thousand five hundred sixty-seven"

Chinese

To convert an integer into words in Chinese, call the toWords.zh function with the number to be converted and (optionally) the configuration parameters:

import { toWords } from '@jofu/number-to-words';

const result = toWords.zh(1234567);
console.log(result); // "一百万二十三四千五百六十七"

Parameters for toWords

The toWords function accepts additional configuration parameters to customize the number-to-words conversion. These parameters are provided as objects of type VietnameseConfig, EnglishConfig, or ChineseConfig and can be customized as follows:

| Parameter | Type | Description | Default | | --------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | | number | number | The number to convert, which can be an integer, a negative number, or a decimal. | (Required) | | config | VietnameseConfig EnglishConfig ChineseConfig | Configuration for number conversion. Can be VietnameseConfig for Vietnamese, EnglishConfig for English, or ChineseConfig for Chinese. | (Required) |

VietnameseConfig

| Parameter | Type | Description | Default | | ----------------------- | -------------------- | --------------------------------------------------------------------------- | -------- | | decimalSeparator | 'phẩy' | 'chấm' | Word used to read the decimal separator (1.5 → "một phẩy năm"). | 'phẩy' | | fractionalPrefix | 'linh' | 'lẻ' | Prefix used before the first digit of the fractional part (e.g., "lẻ năm"). | 'linh' | | useThousandsSeparator | boolean | Whether to add a separator for large units like "triệu", "nghìn", etc. | false |

EnglishConfig

| Parameter | Type | Description | Default | | ----------------------- | --------- | --------------------------------------------------------------------------------------------- | --------- | | point | string | Word used for the decimal separator in English (1.5 → "one point five"). | 'point' | | and | string | Word used to connect parts of numbers with more than one digit, e.g., "one hundred and five". | 'and' | | useThousandsSeparator | boolean | Whether to add a separator for large units like "million", "thousand", etc. | false |

ChineseConfig

| Parameter | Type | Description | Default | | ------------------ | ---------------- | ------------------------------------------------------------------------- | ------- | | decimalSeparator | '点' | '分' | Word used for the decimal separator in Chinese | '点' | | useTraditional | boolean | Whether to use traditional Chinese numerals (e.g., "一" instead of "一"). | false |

Conclusion

The @jofu/number-to-words library offers a simple, efficient, and flexible solution for converting numbers into words in Vietnamese, English, and Chinese. It is the ideal tool for applications requiring numeric values to be represented in text or for user interface display.