Comparing version 0.39.2 to 0.39.3
@@ -16,3 +16,3 @@ /** | ||
clear(): void; | ||
set(index: number, value?: boolean | number): void; | ||
set(index: number, value?: boolean | number): void; | ||
reset(index: number, value: boolean | number): void; | ||
@@ -19,0 +19,0 @@ flip(index: number, value: boolean | number): void; |
@@ -24,3 +24,3 @@ /** | ||
clear(): void; | ||
set(index: number, value?: boolean | number): this; | ||
set(index: number, value?: boolean | number): this; | ||
reset(index: number, value: boolean | number): void; | ||
@@ -27,0 +27,0 @@ flip(index: number, value: boolean | number): void; |
@@ -8,3 +8,3 @@ /** | ||
export default class BKTree<T> { | ||
// Members | ||
@@ -24,3 +24,3 @@ distance: DistanceFunction<T>; | ||
// Statics | ||
static from<I>(iterable: Iterable<I> | {[key: string] : I}, distance: DistanceFunction<I>): BKTree<I>; | ||
static from<I>(iterable: Iterable<I> | {[key: string]: I}, distance: DistanceFunction<I>): BKTree<I>; | ||
} |
@@ -24,3 +24,3 @@ /** | ||
static from<I>( | ||
iterable: Iterable<I> | {[key: string] : I}, | ||
iterable: Iterable<I> | {[key: string]: I}, | ||
comparator?: FibonacciHeapComparator<I> | ||
@@ -46,3 +46,3 @@ ): FibonacciHeap<I>; | ||
// Statics | ||
static from<I>(iterable: Iterable<I> | {[key: string] : I}): FibonacciHeap<I>; | ||
static from<I>(iterable: Iterable<I> | {[key: string]: I}): FibonacciHeap<I>; | ||
} | ||
@@ -66,3 +66,3 @@ | ||
// Statics | ||
static from<I>(iterable: Iterable<I> | {[key: string] : I}): FibonacciHeap<I>; | ||
static from<I>(iterable: Iterable<I> | {[key: string]: I}): FibonacciHeap<I>; | ||
} |
@@ -30,5 +30,5 @@ /** | ||
static from<I>( | ||
iterable: Iterable<I> | {[key: string] : I}, | ||
iterable: Iterable<I> | {[key: string]: I}, | ||
tokenizer?: Tokenizer | TokenizersTuple | ||
): InvertedIndex<I>; | ||
} |
@@ -28,3 +28,3 @@ /** | ||
// Statics | ||
static from<I>(iterable: Iterable<I> | {[key: string] : I}): LinkedList<I>; | ||
static from<I>(iterable: Iterable<I> | {[key: string]: I}): LinkedList<I>; | ||
} |
@@ -5,10 +5,10 @@ /** | ||
*/ | ||
import LRUCache from './lru-cache'; | ||
import LRUCache from './lru-cache'; | ||
export default class LRUCacheWithDelete<K, V> extends LRUCache<K, V> { | ||
export default class LRUCacheWithDelete<K, V> extends LRUCache<K, V> { | ||
delete(key: K): boolean; | ||
delete(key: K): boolean; | ||
remove<T>(key: K, missing?: T): V | T; | ||
remove<T>(key: K, missing?: T): V | T; | ||
} |
@@ -46,3 +46,3 @@ /** | ||
*/ | ||
LRUCacheWithDelete.prototype.clear = function() { | ||
LRUCacheWithDelete.prototype.clear = function() { | ||
LRUCache.prototype.clear.call(this); | ||
@@ -266,3 +266,3 @@ this.deletedSize = 0; | ||
*/ | ||
LRUCacheWithDelete.from = function(iterable, Keys, Values, capacity) { | ||
LRUCacheWithDelete.from = function(iterable, Keys, Values, capacity) { | ||
if (arguments.length < 2) { | ||
@@ -269,0 +269,0 @@ capacity = iterables.guessLength(iterable); |
@@ -43,3 +43,3 @@ /** | ||
else if (!isFinite(this.capacity) || Math.floor(this.capacity) !== this.capacity) | ||
throw new Error('mnemonist/lru-cache: capacity should be a finite positive integer.'); | ||
throw new Error('mnemonist/lru-cache: capacity should be a finite positive integer.'); | ||
@@ -239,8 +239,8 @@ var PointerArray = typed.getPointerArray(capacity); | ||
LRUCache.prototype.peek = function(key) { | ||
var pointer = this.items[key]; | ||
var pointer = this.items[key]; | ||
if (typeof pointer === 'undefined') | ||
return; | ||
if (typeof pointer === 'undefined') | ||
return; | ||
return this.V[pointer]; | ||
return this.V[pointer]; | ||
}; | ||
@@ -247,0 +247,0 @@ |
@@ -5,10 +5,10 @@ /** | ||
*/ | ||
import LRUMap from './lru-map'; | ||
import LRUMap from './lru-map'; | ||
export default class LRUMapWithDelete<K, V> extends LRUMap<K, V> { | ||
export default class LRUMapWithDelete<K, V> extends LRUMap<K, V> { | ||
delete(key: K): boolean; | ||
delete(key: K): boolean; | ||
remove<T>(key: K, missing?: T): V | T; | ||
remove<T>(key: K, missing?: T): V | T; | ||
} |
@@ -46,3 +46,3 @@ /** | ||
*/ | ||
LRUMapWithDelete.prototype.clear = function() { | ||
LRUMapWithDelete.prototype.clear = function() { | ||
LRUMap.prototype.clear.call(this); | ||
@@ -266,3 +266,3 @@ this.deletedSize = 0; | ||
*/ | ||
LRUMapWithDelete.from = function(iterable, Keys, Values, capacity) { | ||
LRUMapWithDelete.from = function(iterable, Keys, Values, capacity) { | ||
if (arguments.length < 2) { | ||
@@ -269,0 +269,0 @@ capacity = iterables.guessLength(iterable); |
@@ -178,11 +178,16 @@ /** | ||
var currentCount = this.multiplicity(item), | ||
newCount = Math.max(0, currentCount - count); | ||
var currentCount = this.items.get(item); | ||
if (typeof currentCount === 'undefined') return; | ||
var newCount = Math.max(0, currentCount - count); | ||
if (newCount === 0) { | ||
this.delete(item); | ||
this.items.delete(item); | ||
this.size -= currentCount; | ||
this.dimension--; | ||
} | ||
else { | ||
this.items.set(item, newCount); | ||
this.size -= (currentCount - newCount); | ||
this.size -= count; | ||
} | ||
@@ -189,0 +194,0 @@ |
{ | ||
"name": "mnemonist", | ||
"version": "0.39.2", | ||
"version": "0.39.3", | ||
"description": "Curated collection of data structures for the JavaScript/TypeScript.", | ||
"scripts": { | ||
"lint": "eslint ./*.js ./utils ./test", | ||
"lint": "eslint --cache ./*.js ./utils ./test", | ||
"lint:fix": "eslint --cache --fix ./*.js ./utils ./test", | ||
"prepublishOnly": "npm run lint && npm test && npm run test:types", | ||
@@ -8,0 +9,0 @@ "test": "mocha", |
@@ -26,3 +26,3 @@ /** | ||
static from<I>( | ||
iterable: Iterable<I> | {[key: string] : I}, | ||
iterable: Iterable<I> | {[key: string]: I}, | ||
levenshtein: LevenshteinDistanceFunction<I>, | ||
@@ -29,0 +29,0 @@ k: number |
@@ -25,4 +25,4 @@ /** | ||
// Statics | ||
static from<I>(iterable: Iterable<I> | {[key: string] : I}): Queue<I>; | ||
static from<I>(iterable: Iterable<I> | {[key: string]: I}): Queue<I>; | ||
static of<I>(...items: Array<I>): Queue<I>; | ||
} |
@@ -15,5 +15,5 @@ /** | ||
export function disjunct<T>(a: Set<T>, b: Set<T>): void; | ||
export function intersectionSize<T>(a: Set<T>, b:Set<T>): number; | ||
export function unionSize<T>(a: Set<T>, b:Set<T>): number; | ||
export function jaccard<T>(a: Set<T>, b:Set<T>): number; | ||
export function intersectionSize<T>(a: Set<T>, b: Set<T>): number; | ||
export function unionSize<T>(a: Set<T>, b: Set<T>): number; | ||
export function jaccard<T>(a: Set<T>, b: Set<T>): number; | ||
export function overlap<T>(a: Set<T>, b: Set<T>): number; |
@@ -25,4 +25,4 @@ /** | ||
// Statics | ||
static from<I>(iterable: Iterable<I> | {[key: string] : I}): Stack<I>; | ||
static from<I>(iterable: Iterable<I> | {[key: string]: I}): Stack<I>; | ||
static of<I>(...items: Array<I>): Stack<I>; | ||
} |
@@ -8,3 +8,3 @@ /** | ||
export default class StaticDisjointSet { | ||
// Members | ||
@@ -11,0 +11,0 @@ dimension: number; |
@@ -21,5 +21,5 @@ /** | ||
inspect(): any; | ||
// Statics | ||
static from<I>(iterable: Iterable<I> | {[key: string] : I}): StaticIntervalTree<I>; | ||
static from<I>(iterable: Iterable<I> | {[key: string]: I}): StaticIntervalTree<I>; | ||
} |
@@ -6,3 +6,3 @@ /** | ||
export default class SuffixArray { | ||
// Members | ||
@@ -9,0 +9,0 @@ array: Array<number>; |
@@ -40,3 +40,3 @@ /** | ||
// Statics | ||
static from<I>(iterable: Iterable<I> | {[key: string] : I}, ArrayClass: IArrayLikeConstructor, capacity?: number): Vector; | ||
static from<I>(iterable: Iterable<I> | {[key: string]: I}, ArrayClass: IArrayLikeConstructor, capacity?: number): Vector; | ||
} | ||
@@ -71,3 +71,3 @@ | ||
// Statics | ||
static from<I>(iterable: Iterable<I> | {[key: string] : I}, capacity?: number): TypedVector; | ||
static from<I>(iterable: Iterable<I> | {[key: string]: I}, capacity?: number): TypedVector; | ||
} | ||
@@ -74,0 +74,0 @@ |
@@ -24,5 +24,5 @@ /** | ||
static from<I>( | ||
iterable: Iterable<I> | {[key: string] : I}, | ||
iterable: Iterable<I> | {[key: string]: I}, | ||
distance: DistanceFunction<I> | ||
): VPTree<I>; | ||
} |
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
378014
13701