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

thai-typo-check

Package Overview
Dependencies
Maintainers
1
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.0 to 1.0.1

12

index.js

@@ -20,11 +20,10 @@ const wordBreak = require("word-break-trie");

function thaiTypoCheck(inputText) {
// return true when input is empty string, null, or undefined
// skip if input is empty string, null, or undefined
if (!inputText) return true;
const dict = fileSync.readFileSync(dictionaryPath, {
const text = fileSync.readFileSync(dictionaryPath, {
encoding: "UTF-8"
});
const dictArray = text.split("\n");
const dictArray = dict.split("\n");
const longestWordLength = dictArray[0].length;

@@ -40,7 +39,8 @@ const currentTrie = trie(dictArray);

}
// return true when pass all validation
return true;
}
// return true when pass all validation
return true;
}
module.exports = thaiTypoCheck;
{
"name": "thai-typo-check",
"version": "1.0.0",
"version": "1.0.1",
"description": "for check thai typo",

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

@@ -5,3 +5,3 @@ const thaiTypoCheck = require(".");

it("should return true when no typo", () => {
expect(thaiTypoCheck("ฉันอยากกินยำ")).toBe(true);
expect(thaiTypoCheck("ฉันอยากกินยำ ")).toBe(true);
expect(thaiTypoCheck("ฉัน อยากกิน ยำ")).toBe(true);

@@ -13,2 +13,3 @@ });

expect(thaiTypoCheck("ฉันอยากกินยำา")).toBe(false);
expect(thaiTypoCheck("ฉัน อยากกินยำมาก กกกกก")).toBe(false);
});

@@ -15,0 +16,0 @@

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