Socket
Book a DemoInstallSign in
Socket

thai-typo-check

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thai-typo-check

for check thai typo

latest
Source
npmnpm
Version
1.0.12
Version published
Maintainers
4
Created
Source

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

Keywords

typo

FAQs

Package last updated on 14 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts