thai-typo-check
Advanced tools
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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
857129
55