@libp2p/utils
Advanced tools
Comparing version 6.5.3 to 6.5.4-5b084e968
@@ -33,3 +33,3 @@ import type { Filter } from './index.js'; | ||
*/ | ||
export declare function createBloomFilter(itemcount: number, errorRate?: number): Filter; | ||
export declare function createBloomFilter(itemCount: number, errorRate?: number): Filter; | ||
//# sourceMappingURL=bloom-filter.d.ts.map |
@@ -63,5 +63,5 @@ // ported from xxbloom - https://github.com/ceejbot/xxbloom/blob/master/LICENSE | ||
const shift = bit % 8; | ||
let bitfield = this.buffer[pos]; | ||
bitfield |= (0x1 << shift); | ||
this.buffer[pos] = bitfield; | ||
let bitField = this.buffer[pos]; | ||
bitField |= (0x1 << shift); | ||
this.buffer[pos] = bitField; | ||
} | ||
@@ -71,4 +71,4 @@ getbit(bit) { | ||
const shift = bit % 8; | ||
const bitfield = this.buffer[pos]; | ||
return (bitfield & (0x1 << shift)) !== 0; | ||
const bitField = this.buffer[pos]; | ||
return (bitField & (0x1 << shift)) !== 0; | ||
} | ||
@@ -80,4 +80,4 @@ } | ||
*/ | ||
export function createBloomFilter(itemcount, errorRate = 0.005) { | ||
const opts = optimize(itemcount, errorRate); | ||
export function createBloomFilter(itemCount, errorRate = 0.005) { | ||
const opts = optimize(itemCount, errorRate); | ||
return new BloomFilter(opts); | ||
@@ -84,0 +84,0 @@ } |
@@ -12,5 +12,5 @@ /** | ||
forecast: number; | ||
private readonly timespan; | ||
private readonly timeSpan; | ||
private previousTime?; | ||
constructor(timespan: number); | ||
constructor(timeSpan: number); | ||
alpha(t: number, pt: number): number; | ||
@@ -17,0 +17,0 @@ push(value: number, time?: number): void; |
@@ -12,6 +12,6 @@ /** | ||
forecast; | ||
timespan; | ||
timeSpan; | ||
previousTime; | ||
constructor(timespan) { | ||
this.timespan = timespan; | ||
constructor(timeSpan) { | ||
this.timeSpan = timeSpan; | ||
this.movingAverage = 0; | ||
@@ -23,3 +23,3 @@ this.variance = 0; | ||
alpha(t, pt) { | ||
return 1 - (Math.exp(-(t - pt) / this.timespan)); | ||
return 1 - (Math.exp(-(t - pt) / this.timeSpan)); | ||
} | ||
@@ -26,0 +26,0 @@ push(value, time = Date.now()) { |
@@ -33,3 +33,3 @@ export interface RateLimiterInit { | ||
/** | ||
* @default rlflx | ||
* @default "rlflx" | ||
*/ | ||
@@ -36,0 +36,0 @@ keyPrefix?: string; |
@@ -12,3 +12,3 @@ import forEach from 'it-foreach'; | ||
let closedWrite = false; | ||
// piggyback on `stream.close` invocations to close maconn | ||
// piggyback on `stream.close` invocations to close multiaddr connection | ||
const streamClose = stream.close.bind(stream); | ||
@@ -19,3 +19,3 @@ stream.close = async (options) => { | ||
}; | ||
// piggyback on `stream.abort` invocations to close maconn | ||
// piggyback on `stream.abort` invocations to close multiaddr connection | ||
const streamAbort = stream.abort.bind(stream); | ||
@@ -26,3 +26,3 @@ stream.abort = (err) => { | ||
}; | ||
// piggyback on `stream.sink` invocations to close maconn | ||
// piggyback on `stream.sink` invocations to close multiaddr connection | ||
const streamSink = stream.sink.bind(stream); | ||
@@ -29,0 +29,0 @@ stream.sink = async (source) => { |
{ | ||
"name": "@libp2p/utils", | ||
"version": "6.5.3", | ||
"version": "6.5.4-5b084e968", | ||
"description": "Package to aggregate shared logic and dependencies for the libp2p ecosystem", | ||
@@ -192,5 +192,5 @@ "license": "Apache-2.0 OR MIT", | ||
"@chainsafe/netmask": "^2.0.0", | ||
"@libp2p/crypto": "^5.0.12", | ||
"@libp2p/interface": "^2.6.0", | ||
"@libp2p/logger": "^5.1.9", | ||
"@libp2p/crypto": "5.0.12-5b084e968", | ||
"@libp2p/interface": "2.6.0-5b084e968", | ||
"@libp2p/logger": "5.1.9-5b084e968", | ||
"@multiformats/multiaddr": "^12.3.3", | ||
@@ -209,3 +209,3 @@ "@sindresorhus/fnv1a": "^3.1.0", | ||
"race-event": "^1.3.0", | ||
"race-signal": "^1.1.0", | ||
"race-signal": "^1.1.2", | ||
"uint8arraylist": "^2.4.8", | ||
@@ -215,3 +215,3 @@ "uint8arrays": "^5.1.0" | ||
"devDependencies": { | ||
"@libp2p/peer-id": "^5.0.13", | ||
"@libp2p/peer-id": "5.0.13-5b084e968", | ||
"@types/netmask": "^2.0.5", | ||
@@ -218,0 +218,0 @@ "aegir": "^45.0.5", |
@@ -84,5 +84,5 @@ // ported from xxbloom - https://github.com/ceejbot/xxbloom/blob/master/LICENSE | ||
let bitfield = this.buffer[pos] | ||
bitfield |= (0x1 << shift) | ||
this.buffer[pos] = bitfield | ||
let bitField = this.buffer[pos] | ||
bitField |= (0x1 << shift) | ||
this.buffer[pos] = bitField | ||
} | ||
@@ -94,4 +94,4 @@ | ||
const bitfield = this.buffer[pos] | ||
return (bitfield & (0x1 << shift)) !== 0 | ||
const bitField = this.buffer[pos] | ||
return (bitField & (0x1 << shift)) !== 0 | ||
} | ||
@@ -104,4 +104,4 @@ } | ||
*/ | ||
export function createBloomFilter (itemcount: number, errorRate: number = 0.005): Filter { | ||
const opts = optimize(itemcount, errorRate) | ||
export function createBloomFilter (itemCount: number, errorRate: number = 0.005): Filter { | ||
const opts = optimize(itemCount, errorRate) | ||
return new BloomFilter(opts) | ||
@@ -108,0 +108,0 @@ } |
@@ -12,7 +12,7 @@ /** | ||
public forecast: number | ||
private readonly timespan: number | ||
private readonly timeSpan: number | ||
private previousTime?: number | ||
constructor (timespan: number) { | ||
this.timespan = timespan | ||
constructor (timeSpan: number) { | ||
this.timeSpan = timeSpan | ||
this.movingAverage = 0 | ||
@@ -25,3 +25,3 @@ this.variance = 0 | ||
alpha (t: number, pt: number): number { | ||
return 1 - (Math.exp(-(t - pt) / this.timespan)) | ||
return 1 - (Math.exp(-(t - pt) / this.timeSpan)) | ||
} | ||
@@ -28,0 +28,0 @@ |
@@ -41,3 +41,3 @@ import delay from 'delay' | ||
/** | ||
* @default rlflx | ||
* @default "rlflx" | ||
*/ | ||
@@ -44,0 +44,0 @@ keyPrefix?: string |
@@ -35,3 +35,3 @@ import forEach from 'it-foreach' | ||
// piggyback on `stream.close` invocations to close maconn | ||
// piggyback on `stream.close` invocations to close multiaddr connection | ||
const streamClose = stream.close.bind(stream) | ||
@@ -43,3 +43,3 @@ stream.close = async (options) => { | ||
// piggyback on `stream.abort` invocations to close maconn | ||
// piggyback on `stream.abort` invocations to close multiaddr connection | ||
const streamAbort = stream.abort.bind(stream) | ||
@@ -51,3 +51,3 @@ stream.abort = (err) => { | ||
// piggyback on `stream.sink` invocations to close maconn | ||
// piggyback on `stream.sink` invocations to close multiaddr connection | ||
const streamSink = stream.sink.bind(stream) | ||
@@ -54,0 +54,0 @@ stream.sink = async (source) => { |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
284353
208
5432
1
+ Added@libp2p/crypto@5.0.12-5b084e968(transitive)
+ Added@libp2p/interface@2.6.0-5b084e968(transitive)
+ Added@libp2p/logger@5.1.9-5b084e968(transitive)
- Removed@libp2p/crypto@5.0.12(transitive)
- Removed@libp2p/interface@2.6.0(transitive)
- Removed@libp2p/logger@5.1.9(transitive)
Updatedrace-signal@^1.1.2