Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

thai-typo-check

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thai-typo-check - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

5

index.d.ts

@@ -1,4 +0,7 @@

declare function thaiTypoCheck(inputText: string): boolean;
declare function thaiTypoCheck(
inputText: string,
customWords?: string[]
): boolean;
declare namespace thaiTypoCheck {}
export = thaiTypoCheck;

6

index.js

@@ -19,3 +19,3 @@ const wordBreak = require("word-break-trie");

function thaiTypoCheck(inputText) {
function thaiTypoCheck(inputText, customWords) {
// skip if input is empty string, null, or undefined

@@ -28,3 +28,5 @@ if (!inputText) return true;

const dictArray = text.split("\n");
if (!!customWords) {
dictArray.push(...customWords);
}
const longestWordLength = dictArray[0].length;

@@ -31,0 +33,0 @@ const currentTrie = trie(dictArray);

{
"name": "thai-typo-check",
"version": "1.0.2",
"version": "1.0.3",
"description": "for check thai typo",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -11,7 +11,8 @@ # thai-typo-check

test("thaiTypoCheck", () => {
const wordBreakableInput = "ฉันอยากกินยำ";
const wordUnBreakableInput = "ฉันอยากกินผฟใก่ร์";
expect(thaiTypoCheck(wordBreakableInput)).toBe(true);
expect(thaiTypoCheck(wordUnBreakableInput)).toBe(false);
const goodSentence = "ฉันอยากกินยำ";
const typoSentence = "ฉันอยากกินผฟใก่ร์";
expect(thaiTypoCheck(goodSentence)).toBe(true);
expect(thaiTypoCheck(typoSentence)).toBe(false);
});
```

@@ -9,2 +9,6 @@ const thaiTypoCheck = require(".");

it("should support custom words", () => {
expect(thaiTypoCheck("ฉันอยากกินยำพัทยา", ["พัทยา"])).toBe(true);
});
it("should return false when found typos", () => {

@@ -11,0 +15,0 @@ expect(thaiTypoCheck("ฉนอยากกินยำ")).toBe(false);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc