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

mnemonist

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mnemonist - npm Package Compare versions

Comparing version 0.20.0 to 0.21.0-beta1

circular-buffer.js

5

CHANGELOG.md
# Changelog
## 0.21.0 (provisional)
* Adding `CircularBuffer`.
* Adding `#.toArray` to `Heap`.
## 0.20.0

@@ -4,0 +9,0 @@

2

finite-stack.js

@@ -186,2 +186,3 @@ /**

array.type = this.ArrayClass.name;
array.capacity = this.capacity;

@@ -207,2 +208,3 @@

*/
// TODO: can optimize if iterable is array-like
FiniteStack.from = function(iterable, ArrayClass, capacity) {

@@ -209,0 +211,0 @@

28

heap.js

@@ -153,12 +153,28 @@ /**

/**
* Method used to convert the heap to an array. Note that it basically clone
* the heap and consumes it completely. This is hardly performant.
*
* @return {array}
*/
Heap.prototype.toArray = function() {
var array = new Array(this.size);
var clone = new Heap(this.comparator);
clone.items = this.items.slice();
clone.size = this.size;
var i = 0;
while (clone.size)
array[i++] = clone.pop();
return array;
};
/**
* Convenience known methods.
*/
Heap.prototype.inspect = function() {
var proxy = {
size: this.size
};
var proxy = this.toArray();
if (this.items.length)
proxy.top = this.items[0];
// Trick so that node displays the name of the constructor

@@ -165,0 +181,0 @@ Object.defineProperty(proxy, 'constructor', {

@@ -18,2 +18,3 @@ /**

BKTree: require('./bk-tree.js'),
CircularBuffer: require('./circular-buffer.js'),
StaticDisjointSet: require('./static-disjoint-set.js'),

@@ -20,0 +21,0 @@ FibonacciHeap: FibonacciHeap,

{
"name": "mnemonist",
"version": "0.20.0",
"version": "0.21.0-beta1",
"description": "Curated collection of data structures for the JavaScript language.",
"scripts": {
"lint": "eslint ./*.js ./utils ./test",
"prepublish": "npm run lint && npm test",
"test": "mocha"
"lint": "eslint ./*.js ./utils ./test/[!types]",
"prepublish": "npm run lint && npm test && npm run test:types",
"test": "mocha",
"test:types": "tsc --lib es2015,dom ./test/types.ts"
},
"files": [
"utils",
"*.d.ts",
"*.js"

@@ -27,2 +29,3 @@ ],

"burkhard-keller tree",
"circular buffer",
"counter",

@@ -73,3 +76,4 @@ "data structures",

"pandemonium": "^1.2.1",
"seedrandom": "^2.4.3"
"seedrandom": "^2.4.3",
"typescript": "^2.7.2"
},

@@ -76,0 +80,0 @@ "eslintConfig": {

@@ -40,5 +40,6 @@ [![Build Status](https://travis-ci.org/Yomguithereal/mnemonist.svg)](https://travis-ci.org/Yomguithereal/mnemonist)

* [Circular Buffer](https://yomguithereal.github.io/mnemonist/circular-buffer)
* [Finite Stack](https://yomguithereal.github.io/mnemonist/finite-stack)
* [Hashed Array Tree](https://yomguithereal.github.io/mnemonist/hashed-array-tree)
* [StaticDisjointSet](https://yomguithereal.github.io/mnemonist/static-disjoint-set)
* [Static DisjointSet](https://yomguithereal.github.io/mnemonist/static-disjoint-set)
* [SparseSet](https://yomguithereal.github.io/mnemonist/sparse-set)

@@ -58,3 +59,3 @@ * [Suffix Array](https://yomguithereal.github.io/mnemonist/suffix-array)

* [StaticIntervalTree](https://yomguithereal.github.io/mnemonist/static-interval-tree)
* [Static IntervalTree](https://yomguithereal.github.io/mnemonist/static-interval-tree)

@@ -61,0 +62,0 @@ **Metric space indexation**

@@ -204,8 +204,7 @@ /**

if (SENTINEL in node)
matches.push([prefix, node[SENTINEL]]);
for (k in node) {
if (k === SENTINEL)
if (k === SENTINEL) {
matches.push([prefix, node[SENTINEL]]);
continue;
}

@@ -255,7 +254,7 @@ nodeStack.push(node[k]);

hasValue = SENTINEL in currentNode;
for (k in currentNode) {
if (k === SENTINEL)
if (k === SENTINEL) {
hasValue = true;
continue;
}

@@ -317,7 +316,7 @@ nodeStack.push(currentNode[k]);

hasValue = SENTINEL in currentNode;
for (k in currentNode) {
if (k === SENTINEL)
if (k === SENTINEL) {
hasValue = true;
continue;
}

@@ -381,7 +380,7 @@ nodeStack.push(currentNode[k]);

hasValue = SENTINEL in currentNode;
for (k in currentNode) {
if (k === SENTINEL)
if (k === SENTINEL) {
hasValue = true;
continue;
}

@@ -388,0 +387,0 @@ nodeStack.push(currentNode[k]);

@@ -98,8 +98,7 @@ /**

if (SENTINEL in node)
matches.push(prefix);
for (k in node) {
if (k === SENTINEL)
if (k === SENTINEL) {
matches.push(prefix);
continue;
}

@@ -106,0 +105,0 @@ nodeStack.push(node[k]);

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