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

@banyudu/chinese-numbers-to-arabic

v1.5.1

Published

Convert Chinese numbers into their Arabic Format

Downloads

3

Readme

Chinese Numbers To Arabic

banner

Convert Chinese Numbers to their Arabic Counterpart. npm

Install

Yarn

yarn add chinese-numbers-to-arabic

NPM

npm install chinese-numbers-to-arabic

PNPM

pnpm install chinese-numbers-to-arabic

Language support

Supports Traditional, Simplified, Financial numbers and some dialects. Only integers are supported, except the limited support for Arabic decimal + Chinese number, like "3.5 萬". The largest supported character is 億/亿.

Usage examples

To Integer

import { toInteger } from "chinese-numbers-to-arabic";

toInteger("兩百四十五"); // 245 - Normal number
toInteger("345 萬"); // 3,450,000 - Mixed Arabic and Chinese
toInteger("3.5萬"); // 35,000 - The only supported type of decimals
toInteger("卅六"); // 36 - Cantonese slang
toInteger("***貳佰零伍元***"); // 205 - finance numbers
toInteger("1000 and one"); // 1000 - ignore non-Chinese words
toInteger("345 abc"); // 354 - ignore non-Chinese words

To Arabic String

import { toArabicString } from "chinese-numbers-to-arabic";

toArabicString("***貳佰零伍元***"); // "***205元***"
toArabicString("354 abc"); // "345 ABC"
toArabicString("3, 5 and 4"); // "3, 5 and 4"
toArabicString("一百. What a great number."); // 100. What a great number.
toArabicString("4 000 000 RMB"); // 4000000 RMB
toArabicString("這款車的價格從34.5萬港幣到55.4萬港幣。"); // 這款車的價格從345000港幣到554000港幣。

Check whether a number is Chinese or not

import { isChineseNumber } from "chinese-numbers-to-arabic";

isChineseNumber("abcd"); // false
isChineseNumber("兩百四十五"); // true

Check whether a number is Arabic or not

import { isArabicNumber } from "chinese-numbers-to-arabic";

isArabicNumber("123123123"); // true
isArabicNumber("兩百四十五"); // false

Add missing units - Converts a string like 8 千 3 萬 into 8 千 3 百萬 (8300*10000).

import { addMissingUnits } from "chinese-numbers-to-arabic";

addMissingUnits("8千3萬"); // 8千3百萬

Visualization of this Repo.

Visualization of this repo

Uighur

Although this library is doing work related to Chinese language but it totally disagrees with Barbaric chinese way on genociding the Ethnic Uighur Community. Winnie the Pooh should start being a human again.