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

spica

Package Overview
Dependencies
Maintainers
1
Versions
804
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spica - npm Package Compare versions

Comparing version 0.0.785 to 0.0.786

3

cache.test.ts

@@ -648,3 +648,4 @@ import { Cache } from './cache';

lru.get(Number.MIN_SAFE_INTEGER + i - 1);
lru.get(Number.MIN_SAFE_INTEGER + i);
trc.get(Number.MIN_SAFE_INTEGER + i);
dwc.get(Number.MIN_SAFE_INTEGER + i + 1);

@@ -651,0 +652,0 @@ if (i + 1 !== capacity) continue;

{
"name": "spica",
"version": "0.0.785",
"version": "0.0.786",
"description": "Supervisor, Coroutine, Channel, select, AtomicPromise, Cancellation, Cache, List, Queue, Stack, and some utils.",

@@ -5,0 +5,0 @@ "private": false,

@@ -12,7 +12,6 @@ import { Heap } from './heap';

private count = 0;
private irregular = 0;
public get length(): number {
return this.count === 0
return this.head === this.tail
? this.head.length
: this.head.length + this.tail.length + size * (this.count - 2) + (this.irregular || size);
: this.head.length + this.count + this.tail.length;
}

@@ -38,6 +37,5 @@ // Faster than queue.length > 0.

assert(this.tail.isEmpty());
++this.count;
if (tail.size !== size && tail !== this.head) {
this.irregular = tail.size;
assert(this.irregular === initsize);
if (this.head !== tail) {
assert(this.head.next !== this.tail);
this.count += tail.size;
}

@@ -47,3 +45,2 @@ }

}
private prev?: FixedQueue<T> = undefined;
public pop(): T | undefined {

@@ -53,16 +50,17 @@ const head = this.head;

if (head.isEmpty() && !head.next.isEmpty()) {
if (this.prev?.isEmpty()) {
this.head = this.prev.next = head.next;
head.next = head;
const tail = this.tail;
// 空になるごとの削除と再作成を避ける
if (tail.next !== head) {
assert(tail.next.next === head);
// 初期サイズの方を消す
tail.next.next = tail.next;
tail.next = head;
assert(head.size === size);
}
else {
this.head = head.next;
this.prev = head;
assert(this.tail.next.isEmpty());
this.head = head.next;
if (this.head !== tail) {
assert(this.head !== this.tail);
this.count -= head.next.size;
}
assert(this.prev.next === this.head);
--this.count;
if (this.head.size === this.irregular) {
assert(this.irregular === initsize);
this.irregular = 0;
}
}

@@ -74,3 +72,2 @@ return value;

this.count = 0;
this.irregular = 0;
}

@@ -110,6 +107,6 @@ public *[Symbol.iterator](): Iterator<T, undefined, undefined> {

}
public peek(index: 0 | -1 = 0): T | undefined {
return index === 0
? this.array[this.head]
: this.array[this.tail - 1 & this.mask];
public peek(index: number = 0): T | undefined {
return index >= 0
? this.array[this.head + index & this.mask]
: this.array[this.tail + index & this.mask];
}

@@ -116,0 +113,0 @@ public push(value: T): void {

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