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

word-break-trie

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

word-break-trie - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

6

index.d.ts

@@ -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");
});
```
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