
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
substring-trie
Advanced tools
Minimalistic trie implementation for prefix searches. It finds the longest string from the dictionary that matches the beginning of the input string, or undefined
if no matching string can be found.
npm install substring-trie
var Trie = require('substring-trie');
var trie = new Trie(['banana', 'grape', 'grapefruit'])
trie.search('banana'); // 'banana'
trie.search('banan'); // undefined
trie.search('bananas'); // 'banana'
trie.search('grape'); // 'grape'
trie.search('grapefruit'); // 'grapefruit'
trie.search('grapefruit and other fruit'); // 'grapefruit'
Note this is not designed for autosuggestions. Instead this is designed as a replacement for regex-based prefix searching:
var regex = /^(banana|grapefruit|grape)/
'banana'.match(regex); // ['banana']
'banan'.match(regex); // null
'bananas'.match(regex); // ['banana']
'grape'.match(regex); // ['grapefruit']
'grapefruit'.match(regex); // ['grapefruit']
'grapefruit and other fruit'.match(regex); // ['grapefruit']
FAQs
Minimalistic trie implementation for prefix searches
The npm package substring-trie receives a total of 2,881 weekly downloads. As such, substring-trie popularity was classified as popular.
We found that substring-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
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.