word-break-trie
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,3 +5,3 @@ interface HasWordFunction { | ||
declare function wordBreakTrie( | ||
declare function wordBreak( | ||
s: string, | ||
@@ -11,5 +11,5 @@ dict: HasWordFunction, | ||
): string[]; | ||
declare namespace wordBreakTrie {} | ||
declare namespace wordBreak {} | ||
export = wordBreakTrie; | ||
export = wordBreak; | ||
@@ -1,2 +0,2 @@ | ||
function wordBreakTrie(s, hasWord, longestWordLength) { | ||
function wordBreak(s, hasWord, longestWordLength) { | ||
const size = s.length; | ||
@@ -13,3 +13,3 @@ if (size === 0) return []; | ||
const end = i === s.length; | ||
const words = !end ? wordBreakTrie(s.substring(i), hasWord, max) : []; | ||
const words = !end ? wordBreak(s.substring(i), hasWord, max) : []; | ||
ret.push(...words); | ||
@@ -22,3 +22,3 @@ return ret; | ||
module.exports = wordBreakTrie; | ||
module.exports = wordBreak; | ||
{ | ||
"name": "word-break-trie", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "word-break util using trie-search dictionary", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,11 +8,11 @@ # word-break-trie | ||
```ts | ||
import wordBreakTrie from "word-break-trie"; | ||
import wordBreak from "word-break-trie"; | ||
import trie from "trie-prefix-tree"; | ||
test("wordBreakTrie", () => { | ||
test("wordBreak", () => { | ||
const input = "ilikesamsung"; | ||
const dict = trie(["samsung", "like", "i"]); | ||
const list = wordBreakTrie(input, dict.hasWord); | ||
const list = wordBreak(input, dict.hasWord); | ||
expect(list.join("|")).toBe("i|like|samsung"); | ||
}); | ||
``` |
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
3941