Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seanghay/khmernumber
🔢 🇰ðŸ‡The smallest (0.25kB) and fastest Khmer number conversion functions.
https://github.com/seanghay/khmernumber
khmer
Last synced: 2 days ago
JSON representation
🔢 🇰ðŸ‡The smallest (0.25kB) and fastest Khmer number conversion functions.
- Host: GitHub
- URL: https://github.com/seanghay/khmernumber
- Owner: seanghay
- Created: 2022-10-16T16:45:02.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-11T10:33:48.000Z (almost 2 years ago)
- Last Synced: 2024-04-23T19:38:09.145Z (7 months ago)
- Topics: khmer
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome-khmer-language - seanghay/khmernumber
README
# Khmer Number
The smallest (0.25kB) and fastest Khmer number conversion functions.
## Installation
```shell
npm install khmernumber
```## Usage
```js
import { toASCII, toKhmer } from "khmernumber";
```## Khmer Numerals -> ASCII
```js
const result = toASCII("០១២៣៤៥៦៧៨៩");
// => 0123456789const result = toASCII("០១២៣៤៥៦៧៨៩abc123");
// => 0123456789abc123
```## ASCII -> Khmer Numerals
```js
const result = toKhmer("0123456789");
// => ០១២៣៤៥៦៧៨៩const result2 = toKhmer("0123456789abc");
// => ០១២៣៤៥៦៧៨៩abc
```## Benchmark
```
khmernumber: 0.686ms
toASCII x 2,926,953 ops/sec ±1.87% (91 runs sampled)
toKhmer x 2,446,022 ops/sec ±1.29% (91 runs sampled)
String.replace: Khmer -> ASCII x 622,731 ops/sec ±1.32% (88 runs sampled)
String.replace: ASCII -> Khmer x 816,557 ops/sec ±0.33% (97 runs sampled)
```## Related
- [seanghay/khmerword](https://github.com/seanghay/khmerword)
- [seanghay/khmercal](https://github.com/seanghay/khmercal)
- [seanghay/split-khmer](https://github.com/seanghay/split-khmer)## License
MIT