New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dtrie

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dtrie - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

.travis.yml

41

lib/automaton.js

@@ -91,23 +91,10 @@ /*

Automaton.prototype.getSize = function() {
var ids = this.collectIds_(),
numNodes = 0;
ids.sort();
// Count ids, skipping duplicate entries.
for (var i = 0; i < ids.length; i++) {
numNodes++;
while (ids[i] == ids[i + 1]) {
i++;
}
}
return numNodes;
var ids = this.collectIds_();
return this.countIds_(ids);
};
/**
* Following transitions recursively, collect ids from
* all reachable nodes. Duplicate ids will be collected.
* Collect nodes' id.
*
* @return A list of node's ids.
* @return A sorted list of node's ids (with duplicate).
*/

@@ -126,6 +113,24 @@ Automaton.prototype.collectIds_ = function() {

return ids;
return ids.sort();
};
/**
* Count nodes' id, skipping duplicates.
*
* @param ids A sorted array of ids.
* @return The number of unique id.
*/
Automaton.prototype.countIds_ = function(ids) {
var count = 0;
for (var i = 0; i < ids.length; i++, count++) {
while (ids[i] == ids[i + 1]) {
i++; // Skip duplicate.
}
}
return count;
};
module.exports = Automaton;
{
"name": "dtrie",
"description": "Trie implementation based on a minimal automaton.",
"version": "1.2.0",
"version": "1.3.0",
"author": "Mathieu Turcotte <turcotte.mat@gmail.com>",

@@ -6,0 +6,0 @@ "keywords": ["trie", "prefix tree", "automaton", "automata", "fsa"],

@@ -1,2 +0,2 @@

# Trie implementation based on a minimal automaton for Node.js
# Trie implementation based on a minimal automaton for Node.js [![Build Status](https://secure.travis-ci.org/MathieuTurcotte/node-trie.png)](http://travis-ci.org/MathieuTurcotte/node-trie)

@@ -3,0 +3,0 @@ Implementation based on "Incremental Construction of Minimal Acyclic

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