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

@navpreetdevpuri/trie-js

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@navpreetdevpuri/trie-js - npm Package Compare versions

Comparing version 1.0.12 to 1.0.13

12

lib/index.js

@@ -91,3 +91,3 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {

if (currentNode[ch]) {
return currentNode;
return currentNode[ch];
}

@@ -106,4 +106,2 @@ }

}
if (!currentNode || !currentNode._isEnd)
return null;
return currentNode;

@@ -151,10 +149,10 @@ };

Trie.prototype.find = function (key) {
var currentNode = this._findNode(key);
if (!currentNode)
var node = this._findNode(key);
if (!node._isEnd)
return null;
return currentNode.values;
return node.values;
};
Trie.prototype.remove = function (key, valueChecker) {
var node = this._findNode(key);
if (!node)
if (!node._isEnd)
return false;

@@ -161,0 +159,0 @@ node.values.forEach(function (value, index) {

{
"name": "@navpreetdevpuri/trie-js",
"version": "1.0.12",
"version": "1.0.13",
"description": "Trie data structure implementation in javascript",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -113,3 +113,3 @@ type TrieNode = {

if (currentNode[ch]) {
return currentNode;
return currentNode[ch];
}

@@ -129,3 +129,2 @@ }

if (!currentNode || !currentNode._isEnd) return null;
return currentNode;

@@ -139,2 +138,3 @@ }

const queue: [TrieNode, string][] = [];
this._pushAllPossibleNodesForPrefix(key, queue);

@@ -188,5 +188,5 @@

find(key): any[] {
let currentNode = this._findNode(key);
if (!currentNode) return null;
return currentNode.values;
let node = this._findNode(key);
if (!node._isEnd) return null;
return node.values;
}

@@ -196,3 +196,3 @@

const node = this._findNode(key);
if (!node) return false;
if (!node._isEnd) return false;
node.values.forEach((value, index) => {

@@ -199,0 +199,0 @@ if (valueChecker(value)) {

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