thai-typo-check
TypeScript icon, indicating that this package has built-in type declarations

1.0.12 • Public • Published

thai-typo-check

utils for check Thai typo

TypeScript

import { thaiTypoCheck, thaiTypoCheckWords } from "thai-typo-check";

const goodSentence = "ฉันอยากกินยำ";
const typoSentence = "ฉันอยากกินผฟใก่ร์";

test("thaiTypoCheck", () => {
  const sentenceIncludesCustomWords = "ฉันอยากกินยำซี้ดพัทยา";

  expect(thaiTypoCheck(goodSentence)).toBe(true);
  expect(thaiTypoCheck(typoSentence)).toBe(false);
  expect(thaiTypoCheck(sentenceIncludesCustomWords, ["ซี้ด", "พัทยา"])).toBe(
    true
  ); // second parameter is the list of custom words
});

test("thaiTypoCheckWords", () => {
  expect(thaiTypoCheckWords(goodSentence)).toBe(undefined);
  expect(thaiTypoCheckWords(typoSentence)).toEqual("ฉัน,อยาก,กิน>>ผฟใก่ร์<<");
});

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i thai-typo-check

Weekly Downloads

1

Version

1.0.12

License

MIT

Unpacked Size

860 kB

Total Files

7

Last publish

Collaborators

  • him-2c
  • omegaspn
  • pakornsak
  • bunyawat