![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
trie-structure
Advanced tools
An implementation of a Trie
The Trie can either be created string by string or from an array of strings.
import { Trie } from "trie-structure";
const trie = new Trie();
const strings = ["he", "hello", "helios", "woof", "dog", "doom"];
trie.addMany(strings);
const allWords = trie.getAllWords(); // => ["he", "hello", "helios", "woof", "dog", "doom"]
const helPrefixedWords = trie.findWords("he"); // => ["hello", "helios"];
public methods:
class Trie {
public add(word: string): void; // adds the word to the Trie
public addMany(words: string[]): void; // invokes add for each string
public remove(word: string): boolean; // removes the word from the Trie, does not delete the node
public findWords(prefix: string): string[]; // Matches all words by the given prefix
public size(): number; // returns how many full words are in the Trie
public getAllWords(): string[]; // returns an array of all the words in the Trie
public contains(word: string): boolean; // returns true if the given string exists within the tree, may not be a full word
public findNode(prefix: string): TrieNode | undefined; // returns first match
}
The items in the Trie
are stored as TrieNodes
these should not need to be directly referenced
class TrieNode {
public isLeaf: boolean; // defaults to false
public readonly children: Map<string, TrieNode>; // defaults to an empty map
public constructor(public readonly char: string) {}
}
FAQs
A JavaScript implementation of a Trie
We found that trie-structure demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.