Comparing version 0.39.7 to 0.39.8
@@ -48,4 +48,7 @@ /** | ||
CircularBuffer.prototype.push = function(item) { | ||
var index = (this.start + this.size) % this.capacity; | ||
var index = this.start + this.size; | ||
if (index >= this.capacity) | ||
index -= this.capacity; | ||
this.items[index] = item; | ||
@@ -55,5 +58,11 @@ | ||
if (this.size === this.capacity) { | ||
index++; | ||
// If start is at the end, we wrap around the buffer | ||
this.start = (index + 1) % this.capacity; | ||
// Wrapping around? | ||
if (index >= this.capacity) { | ||
this.start = 0; | ||
} | ||
else { | ||
this.start = index; | ||
} | ||
@@ -60,0 +69,0 @@ return this.size; |
@@ -51,4 +51,7 @@ /** | ||
var index = (this.start + this.size) % this.capacity; | ||
var index = this.start + this.size; | ||
if (index >= this.capacity) | ||
index -= this.capacity; | ||
this.items[index] = item; | ||
@@ -89,6 +92,9 @@ | ||
const index = (this.start + this.size - 1) % this.capacity; | ||
this.size--; | ||
var index = this.start + this.size; | ||
if (index >= this.capacity) | ||
index -= this.capacity; | ||
return this.items[index]; | ||
@@ -140,3 +146,3 @@ }; | ||
if (index > this.capacity) | ||
if (index >= this.capacity) | ||
index -= this.capacity; | ||
@@ -154,3 +160,3 @@ | ||
FixedDeque.prototype.get = function(index) { | ||
if (this.size === 0) | ||
if (this.size === 0 || index >= this.capacity) | ||
return; | ||
@@ -160,3 +166,3 @@ | ||
if (index > this.capacity) | ||
if (index >= this.capacity) | ||
index -= this.capacity; | ||
@@ -163,0 +169,0 @@ |
@@ -47,3 +47,3 @@ /** | ||
export {default as TrieMap} from './trie-map'; | ||
export {default as Vector, Uint8Vector, Uint8ClampedVector, Int8Vector, Uint16Vector, Int16Vector, Uint32Vector, Int32Vector, Float32Vector, Float64Array} from './vector'; | ||
export {default as Vector, Uint8Vector, Uint8ClampedVector, Int8Vector, Uint16Vector, Int16Vector, Uint32Vector, Int32Vector, Float32Vector, Float64Vector} from './vector'; | ||
export {default as VPTree} from './vp-tree'; |
{ | ||
"name": "mnemonist", | ||
"version": "0.39.7", | ||
"version": "0.39.8", | ||
"description": "Curated collection of data structures for the JavaScript/TypeScript.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -1,2 +0,2 @@ | ||
[![Build Status](https://github.com/Yomguithereal/mnemonist/workflows/Tests/badge.svg)](https://github.com/Yomguithereal/mnemonist/actions) | ||
[![Build Status](https://github.com/Yomguithereal/mnemonist/actions/workflows/tests.yml/badge.svg)](https://github.com/Yomguithereal/mnemonist/actions) | ||
@@ -3,0 +3,0 @@ # Mnemonist |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import {IArrayLikeConstructor} from './utils/types'; | ||
import { IArrayLikeConstructor } from './utils/types'; | ||
@@ -82,2 +82,2 @@ type VectorOptions = { | ||
export class Float32Vector extends TypedVector {} | ||
export class Float64Array extends TypedVector {} | ||
export class Float64Vector extends TypedVector {} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
379485
13746