@rimbu/hashed
Advanced tools
Comparing version 0.5.11 to 0.6.0
@@ -16,10 +16,10 @@ "use strict"; | ||
_this.typeTag = 'HashMap'; | ||
_this.blockCapacity = 1 << _this.blockSizeBits; | ||
_this.builder = function () { | ||
return new hashmap_custom_1.HashMapBlockBuilder(_this); | ||
}; | ||
_this.blockCapacity = 1 << blockSizeBits; | ||
_this.blockMask = _this.blockCapacity - 1; | ||
_this.maxDepth = Math.ceil(32 / _this.blockSizeBits); | ||
_this.maxDepth = Math.ceil(32 / blockSizeBits); | ||
_this._empty = new hashmap_custom_1.HashMapEmpty(_this); | ||
_this._emptyBlock = new hashmap_custom_1.HashMapBlock(_this, null, null, 0, 0); | ||
_this.builder = function () { | ||
return new hashmap_custom_1.HashMapBlockBuilder(_this); | ||
}; | ||
return _this; | ||
@@ -26,0 +26,0 @@ } |
@@ -16,10 +16,10 @@ "use strict"; | ||
_this.typeTag = 'HashSet'; | ||
_this.blockCapacity = 1 << _this.blockSizeBits; | ||
_this.builder = function () { | ||
return new hashset_custom_1.HashSetBlockBuilder(_this); | ||
}; | ||
_this.blockCapacity = 1 << blockSizeBits; | ||
_this.blockMask = _this.blockCapacity - 1; | ||
_this.maxDepth = Math.ceil(32 / _this.blockSizeBits); | ||
_this.maxDepth = Math.ceil(32 / blockSizeBits); | ||
_this._empty = new hashset_custom_1.HashSetEmpty(_this); | ||
_this._emptyBlock = new hashset_custom_1.HashSetBlock(_this, null, null, 0, 0); | ||
_this.builder = function () { | ||
return new hashset_custom_1.HashSetBlockBuilder(_this); | ||
}; | ||
return _this; | ||
@@ -26,0 +26,0 @@ } |
@@ -14,3 +14,3 @@ "use strict"; | ||
_this.context = context; | ||
_this.addAll = _this.context.from; | ||
_this.addAll = context.from; | ||
return _this; | ||
@@ -17,0 +17,0 @@ } |
import { CustomBase } from '@rimbu/collection-types'; | ||
import { HashMapBlock, HashMapBlockBuilder, HashMapCollision, HashMapEmpty, HashMapNonEmptyBase, } from '../hashmap-custom'; | ||
import { HashMapBlock, HashMapBlockBuilder, HashMapCollision, HashMapEmpty, HashMapNonEmptyBase } from '../hashmap-custom'; | ||
export class HashMapContext extends CustomBase.RMapBase.ContextBase { | ||
@@ -11,10 +11,10 @@ constructor(hasher, eq, blockSizeBits, listContext) { | ||
this.typeTag = 'HashMap'; | ||
this.blockCapacity = 1 << this.blockSizeBits; | ||
this.builder = () => { | ||
return new HashMapBlockBuilder(this); | ||
}; | ||
this.blockCapacity = 1 << blockSizeBits; | ||
this.blockMask = this.blockCapacity - 1; | ||
this.maxDepth = Math.ceil(32 / this.blockSizeBits); | ||
this.maxDepth = Math.ceil(32 / blockSizeBits); | ||
this._empty = new HashMapEmpty(this); | ||
this._emptyBlock = new HashMapBlock(this, null, null, 0, 0); | ||
this.builder = () => { | ||
return new HashMapBlockBuilder(this); | ||
}; | ||
} | ||
@@ -21,0 +21,0 @@ hash(value) { |
@@ -11,10 +11,10 @@ import { CustomBase } from '@rimbu/collection-types'; | ||
this.typeTag = 'HashSet'; | ||
this.blockCapacity = 1 << this.blockSizeBits; | ||
this.builder = () => { | ||
return new HashSetBlockBuilder(this); | ||
}; | ||
this.blockCapacity = 1 << blockSizeBits; | ||
this.blockMask = this.blockCapacity - 1; | ||
this.maxDepth = Math.ceil(32 / this.blockSizeBits); | ||
this.maxDepth = Math.ceil(32 / blockSizeBits); | ||
this._empty = new HashSetEmpty(this); | ||
this._emptyBlock = new HashSetBlock(this, null, null, 0, 0); | ||
this.builder = () => { | ||
return new HashSetBlockBuilder(this); | ||
}; | ||
} | ||
@@ -21,0 +21,0 @@ isNonEmptyInstance(source) { |
@@ -9,3 +9,3 @@ import { Arr, RimbuError } from '@rimbu/base'; | ||
this.context = context; | ||
this.addAll = this.context.from; | ||
this.addAll = context.from; | ||
} | ||
@@ -12,0 +12,0 @@ has() { |
import { CustomBase } from '@rimbu/collection-types'; | ||
import { Eq } from '@rimbu/common'; | ||
import { List } from '@rimbu/list'; | ||
import { Hasher } from '../hasher'; | ||
import { HashMapBlock, HashMapBlockBuilder, HashMapCollision, HashMapEmpty, MapBlockBuilderEntry, MapEntrySet } from '../hashmap-custom'; | ||
import { HashMap } from '../internal'; | ||
import type { Eq } from '@rimbu/common'; | ||
import type { List } from '@rimbu/list'; | ||
import type { Hasher } from '../hasher'; | ||
import { HashMapBlock, HashMapBlockBuilder, HashMapCollision, MapBlockBuilderEntry, MapEntrySet } from '../hashmap-custom'; | ||
import type { HashMap } from '../internal'; | ||
export declare class HashMapContext<UK> extends CustomBase.RMapBase.ContextBase<UK, HashMap.Types> implements HashMap.Context<UK> { | ||
@@ -12,9 +12,9 @@ readonly hasher: Hasher<UK>; | ||
readonly listContext: List.Context; | ||
constructor(hasher: Hasher<UK>, eq: Eq<UK>, blockSizeBits: number, listContext: List.Context); | ||
readonly typeTag = "HashMap"; | ||
readonly blockCapacity: number; | ||
readonly blockMask: number; | ||
readonly maxDepth: number; | ||
readonly _empty: HashMapEmpty<any, any>; | ||
readonly _empty: HashMap<any, any>; | ||
readonly _emptyBlock: HashMapBlock<any, any>; | ||
constructor(hasher: Hasher<UK>, eq: Eq<UK>, blockSizeBits: number, listContext: List.Context); | ||
readonly typeTag = "HashMap"; | ||
hash(value: UK): number; | ||
@@ -21,0 +21,0 @@ getKeyIndex(level: number, hash: number): number; |
import { Token } from '@rimbu/base'; | ||
import { CustomBase } from '@rimbu/collection-types'; | ||
import { ArrayNonEmpty, OptLazy, OptLazyOr, RelatedTo, ToJSON, TraverseState, Update } from '@rimbu/common'; | ||
import { List } from '@rimbu/list'; | ||
import type { List } from '@rimbu/list'; | ||
import { Stream, StreamSource } from '@rimbu/stream'; | ||
import { HashMapContext } from '../hashmap-custom'; | ||
import { HashMap } from '../internal'; | ||
import type { HashMapContext } from '../hashmap-custom'; | ||
import type { HashMap } from '../internal'; | ||
export declare class HashMapEmpty<K = any, V = any> extends CustomBase.EmptyBase implements HashMap<K, V> { | ||
@@ -9,0 +9,0 @@ readonly context: HashMapContext<K>; |
@@ -1,5 +0,5 @@ | ||
import { CustomBase, RMap } from '@rimbu/collection-types'; | ||
import type { CustomBase, RMap } from '@rimbu/collection-types'; | ||
import { Eq, OmitStrong } from '@rimbu/common'; | ||
import { List } from '@rimbu/list'; | ||
import { Stream, Streamable } from '@rimbu/stream'; | ||
import type { Stream, Streamable } from '@rimbu/stream'; | ||
import { Hasher } from '../hasher'; | ||
@@ -6,0 +6,0 @@ /** |
@@ -5,4 +5,4 @@ import { RelatedTo, TraverseState } from '@rimbu/common'; | ||
import { BlockBuilderBase, CollisionBuilderBase } from '../hashed-custom'; | ||
import { HashSetBlock, HashSetCollision, HashSetContext } from '../hashset-custom'; | ||
import { HashSet } from '../internal'; | ||
import type { HashSetBlock, HashSetCollision, HashSetContext } from '../hashset-custom'; | ||
import type { HashSet } from '../internal'; | ||
export declare type SetBlockBuilderEntry<T> = HashSetBlockBuilder<T> | HashSetCollisionBuilder<T>; | ||
@@ -9,0 +9,0 @@ export declare class HashSetBlockBuilder<T> extends BlockBuilderBase<T> implements HashSet.Builder<T> { |
import { CustomBase } from '@rimbu/collection-types'; | ||
import { Eq } from '@rimbu/common'; | ||
import { List } from '@rimbu/list'; | ||
import { StreamSource } from '@rimbu/stream'; | ||
import { Hasher } from '../hasher'; | ||
import type { Eq } from '@rimbu/common'; | ||
import type { List } from '@rimbu/list'; | ||
import type { StreamSource } from '@rimbu/stream'; | ||
import type { Hasher } from '../hasher'; | ||
import { HashSetBlock, HashSetBlockBuilder, HashSetCollision, SetBlockBuilderEntry, SetEntrySet } from '../hashset-custom'; | ||
import { HashSet } from '../internal'; | ||
import type { HashSet } from '../internal'; | ||
export declare class HashSetContext<UT> extends CustomBase.RSetBase.ContextBase<UT, HashSet.Types> implements HashSet.Context<UT> { | ||
@@ -13,4 +13,2 @@ readonly hasher: Hasher<UT>; | ||
readonly listContext: List.Context; | ||
constructor(hasher: Hasher<UT>, eq: Eq<UT>, blockSizeBits: number, listContext: List.Context); | ||
readonly typeTag = "HashSet"; | ||
readonly blockCapacity: number; | ||
@@ -21,2 +19,4 @@ readonly blockMask: number; | ||
readonly _emptyBlock: HashSetBlock<any>; | ||
constructor(hasher: Hasher<UT>, eq: Eq<UT>, blockSizeBits: number, listContext: List.Context); | ||
readonly typeTag = "HashSet"; | ||
isNonEmptyInstance(source: any): source is any; | ||
@@ -23,0 +23,0 @@ hash(value: UT): number; |
import { CustomBase } from '@rimbu/collection-types'; | ||
import { ArrayNonEmpty, RelatedTo, ToJSON, TraverseState } from '@rimbu/common'; | ||
import { List } from '@rimbu/list'; | ||
import type { List } from '@rimbu/list'; | ||
import { Stream, StreamSource } from '@rimbu/stream'; | ||
import { HashSetContext } from '../hashset-custom'; | ||
import { HashSet } from '../internal'; | ||
import type { HashSetContext } from '../hashset-custom'; | ||
import type { HashSet } from '../internal'; | ||
export declare class HashSetEmpty<T = any> extends CustomBase.EmptyBase implements HashSet<T> { | ||
readonly context: HashSetContext<T>; | ||
readonly addAll: any; | ||
constructor(context: HashSetContext<T>); | ||
has(): false; | ||
add(value: T): HashSet.NonEmpty<T>; | ||
addAll: any; | ||
remove(): this; | ||
@@ -24,3 +24,3 @@ removeAll(): this; | ||
export declare abstract class HashSetNonEmptyBase<T> extends CustomBase.NonEmptyBase<T> implements HashSet.NonEmpty<T> { | ||
abstract context: HashSetContext<T>; | ||
abstract readonly context: HashSetContext<T>; | ||
abstract readonly size: number; | ||
@@ -27,0 +27,0 @@ abstract stream(): Stream.NonEmpty<T>; |
@@ -1,5 +0,5 @@ | ||
import { CustomBase } from '@rimbu/collection-types'; | ||
import type { CustomBase } from '@rimbu/collection-types'; | ||
import { Eq, OmitStrong } from '@rimbu/common'; | ||
import { List } from '@rimbu/list'; | ||
import { Streamable } from '@rimbu/stream'; | ||
import type { Streamable } from '@rimbu/stream'; | ||
import { Hasher } from '../hasher'; | ||
@@ -6,0 +6,0 @@ /** |
{ | ||
"name": "@rimbu/hashed", | ||
"version": "0.5.11", | ||
"version": "0.6.0", | ||
"description": "Immutable HashMap and HashSet implementations for TypeScript", | ||
@@ -44,2 +44,3 @@ "keywords": [ | ||
"build": "yarn clean && yarn bundle", | ||
"build:deno": "rimraf deno_dist ../../deno_dist/hashed && denoify && cp ../../config/mod_ts_template deno_dist/mod.ts && mv deno_dist ../../deno_dist/hashed", | ||
"bundle": "yarn bundle:main && yarn bundle:module && yarn bundle:types", | ||
@@ -61,7 +62,7 @@ "bundle:main": "tsc --p tsconfig.main.json", | ||
"dependencies": { | ||
"@rimbu/base": "^0.5.9", | ||
"@rimbu/collection-types": "^0.5.11", | ||
"@rimbu/common": "^0.5.9", | ||
"@rimbu/list": "^0.5.11", | ||
"@rimbu/stream": "^0.5.11" | ||
"@rimbu/base": "^0.6.0", | ||
"@rimbu/collection-types": "^0.6.0", | ||
"@rimbu/common": "^0.6.0", | ||
"@rimbu/list": "^0.6.0", | ||
"@rimbu/stream": "^0.6.0" | ||
}, | ||
@@ -71,3 +72,6 @@ "publishConfig": { | ||
}, | ||
"gitHead": "0158eaad0dec4503e92cb308af952869d68faad5" | ||
"denoify": { | ||
"replacer": "../../config/denoify-rimbu-replacer.js" | ||
}, | ||
"gitHead": "dbcaad0cb6b1e31ffa64ca2739b9ddb0fc178ebc" | ||
} |
<p align="center"> | ||
<img src="../../assets/rimbu_logo.svg" /> | ||
<img src="https://github.com/rimbu-org/rimbu/raw/main/assets/rimbu_logo.svg" /> | ||
</p> | ||
@@ -18,2 +18,4 @@ | ||
Or [Try Me Out](https://codesandbox.io/s/rimbu-sandbox-d4tbk?previewwindow=console&view=split&editorsize=65&moduleview=1&module=/src/index.ts) in CodeSandBox. | ||
## Installation | ||
@@ -37,5 +39,3 @@ | ||
{ | ||
// ... | ||
"compilerOptions": { | ||
// ... | ||
"skipLibCheck": true, | ||
@@ -42,0 +42,0 @@ "noStrictGenericChecks": true |
import { CustomBase } from '@rimbu/collection-types'; | ||
import { Eq } from '@rimbu/common'; | ||
import { List } from '@rimbu/list'; | ||
import { Hasher } from '../hasher'; | ||
import type { Eq } from '@rimbu/common'; | ||
import type { List } from '@rimbu/list'; | ||
import type { Hasher } from '../hasher'; | ||
import { | ||
@@ -12,5 +12,5 @@ HashMapBlock, | ||
MapBlockBuilderEntry, | ||
MapEntrySet, | ||
MapEntrySet | ||
} from '../hashmap-custom'; | ||
import { HashMap } from '../internal'; | ||
import type { HashMap } from '../internal'; | ||
@@ -21,2 +21,9 @@ export class HashMapContext<UK> | ||
{ | ||
readonly blockCapacity: number; | ||
readonly blockMask: number; | ||
readonly maxDepth: number; | ||
readonly _empty: HashMap<any, any>; | ||
readonly _emptyBlock: HashMapBlock<any, any>; | ||
constructor( | ||
@@ -29,18 +36,13 @@ readonly hasher: Hasher<UK>, | ||
super(); | ||
this.blockCapacity = 1 << blockSizeBits; | ||
this.blockMask = this.blockCapacity - 1; | ||
this.maxDepth = Math.ceil(32 / blockSizeBits); | ||
this._empty = new HashMapEmpty<any, any>(this); | ||
this._emptyBlock = new HashMapBlock(this, null, null, 0, 0); | ||
} | ||
readonly typeTag = 'HashMap'; | ||
readonly blockCapacity = 1 << this.blockSizeBits; | ||
readonly blockMask = this.blockCapacity - 1; | ||
readonly maxDepth = Math.ceil(32 / this.blockSizeBits); | ||
readonly _empty = new HashMapEmpty<any, any>(this); | ||
readonly _emptyBlock: HashMapBlock<any, any> = new HashMapBlock( | ||
this, | ||
null, | ||
null, | ||
0, | ||
0 | ||
); | ||
hash(value: UK): number { | ||
@@ -47,0 +49,0 @@ return this.hasher.hash(value); |
@@ -12,6 +12,6 @@ import { Arr, Entry, RimbuError, Token } from '@rimbu/base'; | ||
} from '@rimbu/common'; | ||
import { List } from '@rimbu/list'; | ||
import type { List } from '@rimbu/list'; | ||
import { Stream, StreamSource } from '@rimbu/stream'; | ||
import { HashMapContext } from '../hashmap-custom'; | ||
import { HashMap } from '../internal'; | ||
import type { HashMapContext } from '../hashmap-custom'; | ||
import type { HashMap } from '../internal'; | ||
@@ -18,0 +18,0 @@ export class HashMapEmpty<K = any, V = any> |
@@ -1,5 +0,5 @@ | ||
import { CustomBase, RMap } from '@rimbu/collection-types'; | ||
import type { CustomBase, RMap } from '@rimbu/collection-types'; | ||
import { Eq, OmitStrong } from '@rimbu/common'; | ||
import { List } from '@rimbu/list'; | ||
import { Stream, Streamable } from '@rimbu/stream'; | ||
import type { Stream, Streamable } from '@rimbu/stream'; | ||
import { Hasher } from '../hasher'; | ||
@@ -6,0 +6,0 @@ import { HashMapContext } from '../hashmap-custom'; |
@@ -6,3 +6,3 @@ import { Arr, RimbuError } from '@rimbu/base'; | ||
import { BlockBuilderBase, CollisionBuilderBase } from '../hashed-custom'; | ||
import { | ||
import type { | ||
HashSetBlock, | ||
@@ -12,3 +12,3 @@ HashSetCollision, | ||
} from '../hashset-custom'; | ||
import { HashSet } from '../internal'; | ||
import type { HashSet } from '../internal'; | ||
@@ -15,0 +15,0 @@ export type SetBlockBuilderEntry<T> = |
import { CustomBase } from '@rimbu/collection-types'; | ||
import { Eq } from '@rimbu/common'; | ||
import { List } from '@rimbu/list'; | ||
import { StreamSource } from '@rimbu/stream'; | ||
import { Hasher } from '../hasher'; | ||
import type { Eq } from '@rimbu/common'; | ||
import type { List } from '@rimbu/list'; | ||
import type { StreamSource } from '@rimbu/stream'; | ||
import type { Hasher } from '../hasher'; | ||
import { | ||
@@ -15,3 +15,3 @@ HashSetBlock, | ||
} from '../hashset-custom'; | ||
import { HashSet } from '../internal'; | ||
import type { HashSet } from '../internal'; | ||
@@ -22,2 +22,9 @@ export class HashSetContext<UT> | ||
{ | ||
readonly blockCapacity: number; | ||
readonly blockMask: number; | ||
readonly maxDepth: number; | ||
readonly _empty: HashSet<any>; | ||
readonly _emptyBlock: HashSetBlock<any>; | ||
constructor( | ||
@@ -30,18 +37,13 @@ readonly hasher: Hasher<UT>, | ||
super(); | ||
this.blockCapacity = 1 << blockSizeBits; | ||
this.blockMask = this.blockCapacity - 1; | ||
this.maxDepth = Math.ceil(32 / blockSizeBits); | ||
this._empty = new HashSetEmpty<any>(this); | ||
this._emptyBlock = new HashSetBlock(this, null, null, 0, 0); | ||
} | ||
readonly typeTag = 'HashSet'; | ||
readonly blockCapacity = 1 << this.blockSizeBits; | ||
readonly blockMask = this.blockCapacity - 1; | ||
readonly maxDepth = Math.ceil(32 / this.blockSizeBits); | ||
readonly _empty: HashSet<any> = new HashSetEmpty<any>(this); | ||
readonly _emptyBlock: HashSetBlock<any> = new HashSetBlock( | ||
this, | ||
null, | ||
null, | ||
0, | ||
0 | ||
); | ||
isNonEmptyInstance(source: any): source is any { | ||
@@ -48,0 +50,0 @@ return source instanceof HashSetNonEmptyBase; |
import { Arr, RimbuError } from '@rimbu/base'; | ||
import { CustomBase } from '@rimbu/collection-types'; | ||
import { ArrayNonEmpty, RelatedTo, ToJSON, TraverseState } from '@rimbu/common'; | ||
import { List } from '@rimbu/list'; | ||
import type { List } from '@rimbu/list'; | ||
import { Stream, StreamSource } from '@rimbu/stream'; | ||
import { HashSetContext } from '../hashset-custom'; | ||
import { HashSet } from '../internal'; | ||
import type { HashSetContext } from '../hashset-custom'; | ||
import type { HashSet } from '../internal'; | ||
@@ -13,4 +13,8 @@ export class HashSetEmpty<T = any> | ||
{ | ||
readonly addAll: any; | ||
constructor(readonly context: HashSetContext<T>) { | ||
super(); | ||
this.addAll = context.from; | ||
} | ||
@@ -26,4 +30,2 @@ | ||
addAll = this.context.from; | ||
remove(): this { | ||
@@ -80,3 +82,3 @@ return this; | ||
{ | ||
abstract context: HashSetContext<T>; | ||
abstract readonly context: HashSetContext<T>; | ||
abstract readonly size: number; | ||
@@ -83,0 +85,0 @@ abstract stream(): Stream.NonEmpty<T>; |
@@ -1,5 +0,5 @@ | ||
import { CustomBase } from '@rimbu/collection-types'; | ||
import type { CustomBase } from '@rimbu/collection-types'; | ||
import { Eq, OmitStrong } from '@rimbu/common'; | ||
import { List } from '@rimbu/list'; | ||
import { Streamable } from '@rimbu/stream'; | ||
import type { Streamable } from '@rimbu/stream'; | ||
import { Hasher } from '../hasher'; | ||
@@ -6,0 +6,0 @@ import { HashSetContext } from '../hashset-custom'; |
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 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
478662
8404
+ Added@rimbu/base@0.6.7(transitive)
+ Added@rimbu/collection-types@0.6.1(transitive)
+ Added@rimbu/common@0.6.10.7.5(transitive)
+ Added@rimbu/list@0.6.2(transitive)
+ Added@rimbu/stream@0.6.1(transitive)
+ Addedtslib@2.8.1(transitive)
- Removed@rimbu/base@0.5.9(transitive)
- Removed@rimbu/collection-types@0.5.11(transitive)
- Removed@rimbu/common@0.5.9(transitive)
- Removed@rimbu/list@0.5.11(transitive)
- Removed@rimbu/stream@0.5.11(transitive)
Updated@rimbu/base@^0.6.0
Updated@rimbu/common@^0.6.0
Updated@rimbu/list@^0.6.0
Updated@rimbu/stream@^0.6.0