@blackglory/structures
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -18,1 +18,2 @@ export * from './box'; | ||
export { DynamicTypedArray } from './dynamic-typed-array'; | ||
export * from './sorted-set'; |
@@ -36,2 +36,3 @@ "use strict"; | ||
Object.defineProperty(exports, "DynamicTypedArray", { enumerable: true, get: function () { return dynamic_typed_array_1.DynamicTypedArray; } }); | ||
__exportStar(require("./sorted-set"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -6,2 +6,3 @@ export declare class SparseSet implements Iterable<number> { | ||
[Symbol.iterator](): IterableIterator<number>; | ||
constructor(array?: number[]); | ||
values(): Iterable<number>; | ||
@@ -8,0 +9,0 @@ has(value: number): boolean; |
@@ -5,5 +5,11 @@ "use strict"; | ||
class SparseSet { | ||
constructor() { | ||
constructor(array = []) { | ||
this.indexToValue = []; | ||
this.valueToIndex = []; | ||
const valueToIndex = []; | ||
if (array.length > 0) { | ||
for (const [index, value] of array.entries()) { | ||
valueToIndex[value] = index; | ||
} | ||
} | ||
this.valueToIndex = valueToIndex; | ||
} | ||
@@ -10,0 +16,0 @@ get [Symbol.toStringTag]() { |
@@ -18,1 +18,2 @@ export * from './box'; | ||
export { DynamicTypedArray } from './dynamic-typed-array'; | ||
export * from './sorted-set'; |
@@ -36,2 +36,3 @@ "use strict"; | ||
Object.defineProperty(exports, "DynamicTypedArray", { enumerable: true, get: function () { return dynamic_typed_array_1.DynamicTypedArray; } }); | ||
__exportStar(require("./sorted-set"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -6,2 +6,3 @@ export declare class SparseSet implements Iterable<number> { | ||
[Symbol.iterator](): IterableIterator<number>; | ||
constructor(array?: number[]); | ||
values(): Iterable<number>; | ||
@@ -8,0 +9,0 @@ has(value: number): boolean; |
@@ -5,5 +5,11 @@ "use strict"; | ||
class SparseSet { | ||
constructor() { | ||
constructor(array = []) { | ||
this.indexToValue = []; | ||
this.valueToIndex = []; | ||
const valueToIndex = []; | ||
if (array.length > 0) { | ||
for (const [index, value] of array.entries()) { | ||
valueToIndex[value] = index; | ||
} | ||
} | ||
this.valueToIndex = valueToIndex; | ||
} | ||
@@ -10,0 +16,0 @@ get [Symbol.toStringTag]() { |
{ | ||
"name": "@blackglory/structures", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -216,2 +216,4 @@ # structures | ||
constructor(array?: number[]) | ||
values(): Iterable<number> | ||
@@ -280,4 +282,4 @@ | ||
has(value: number): boolean | ||
add(value: number): void | ||
has(value: number): boolean | ||
delete(value: number): void | ||
@@ -304,1 +306,16 @@ } | ||
``` | ||
### SortedSet | ||
```ts | ||
class SortedSet<T> { | ||
get [Symbol.toStringTag](): string | ||
[Symbol.iterator](): IterableIterator<T> | ||
constructor(compare: (a: T, b: T) => number) | ||
values(): Iterable<T> | ||
has(value: T): boolean | ||
add(value: T): void | ||
delete(value: T): void | ||
} | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
7211172
139
42312
319