Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
ternary-search-trie
Advanced tools
A ternary search trie implementation in TypeScript.
You can install the package via npm or yarn.
npm install ternary-search-trie
yarn add ternary-search-trie
End with an example of getting some data out of the system or using it for a little demo
Represents a ternary search trie.
import { Trie } from 'ternary-search-trie';
interface ValueType {
data: string;
}
const trie = new Trie<ValueType>();
Gets the size of the tree in terms of the number of nodes present within the tree.
Gets all keys present in the tree.
Creates a new node in the tree with the specified key and value.
Param | Type | Description |
---|---|---|
key | string | The key of the node |
value | ValueType | The value of the node |
Recursively searches the tree for the node with the specified key and returns its value if it exists.
Param | Type | Description |
---|---|---|
key | string | The key of the node |
Deletes a node from the tree if it exists.
Param | Type | Description |
---|---|---|
key | string | The key of the node to delete |
Performs a depth-first traversal of the tree starting from the root node.
Param | Type | Description |
---|---|---|
callback | (node: TrieNode) => void | The callback to execute at each visited node |
Searches the tree using the specified prefix.
Param | Type | Description |
---|---|---|
prefix | string | The prefix to search by |
callback | (prefix: string, node: TrieNode) => void | The callback to execute at each visited node |
Param | Type | Description |
---|---|---|
options | object | Optional parameters for printing the tree |
options.showFunctions | boolean | Determines whether or not functions in the tree should be displayed. |
options.showValues | boolean | Determines whether or not values in the tree should be displayed. |
options.skipKeys | string[] | Keys in the tree that should not be displayed. |
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
This project is licensed under the MIT License - see the LICENSE file for details
FAQs
A ternary search tree implementation in TypeScript.
The npm package ternary-search-trie receives a total of 1 weekly downloads. As such, ternary-search-trie popularity was classified as not popular.
We found that ternary-search-trie 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.