Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seanghay/is-khmer
Khmer utility functions
https://github.com/seanghay/is-khmer
khmer khmer-unicode
Last synced: 30 days ago
JSON representation
Khmer utility functions
- Host: GitHub
- URL: https://github.com/seanghay/is-khmer
- Owner: seanghay
- License: apache-2.0
- Created: 2022-09-28T04:16:10.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-16T06:46:38.000Z (about 2 years ago)
- Last Synced: 2024-11-17T07:20:39.688Z (about 1 month ago)
- Topics: khmer, khmer-unicode
- Language: TypeScript
- Homepage:
- Size: 61.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
- awesome-khmer-language - Khmer utility functions
README
Khmer utility functions
[![tests](https://github.com/seanghay/is-khmer/actions/workflows/tests.yml/badge.svg)](https://github.com/seanghay/is-khmer/actions/workflows/tests.yml)
## Installation
```shell
# pnpm
pnpm add is-khmer# npm
npm add is-khmer# yarn
yarn add is-khmer
```## Browser
```js
import {
isKhmer,
containsKhmer,
parseKhmer
} from "https://unpkg.com/is-khmer"
```## API
### `isKhmer(text: string) => boolean`
Check if a string is in Khmer language
```js
import { isKhmer } from "is-khmer";isKhmer("កូនខ្មែរ");
// => trueisKhmer("Cambodia");
// => false
```### `containsKhmer(text: string) => boolean`
Check if a string contains Khmer language
```js
import { containsKhmer } from "is-khmer";containsKhmer("Proud to be ខ្មែរ");
// => truecontainsKhmer("Proud to be Cambodian");
// => false
```### `parseKhmer(text: string) => KhmerMatchResult[]`
Extract Khmer text from a string.
```js
import { parseKhmer, KhmerMatchResult } from "is-khmer";const result = parseKhmer("ដោយយល់ឃើញថា ការមិនទទួលស្គាល់");
// =>
[
{ start: 0, end: 11, value: "ដោយយល់ឃើញថា" },
{ start: 12, end: 28, value: "ការមិនទទួលស្គាល់" },
];
```## License
Apache 2.0