distillate 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,5 +18,17 @@ interface HllSizing {
18
18
  * `relativeError`. Throws {@link ParamError} when even `HLL_MAX_P` cannot.
19
19
  */
20
20
  declare function hllSizing(relativeError: number): HllSizing;
21
+ /** Count-Min geometry: the `CountMinParams` fields a sizing solve determines. */
22
+ interface CountMinSizing {
23
+ /** Counters per row. */
24
+ width: number;
25
+ /** Number of rows, one probe each. */
26
+ depth: number;
27
+ }
28
+ /**
29
+ * Count-Min sizing: `width` columns and `depth` rows for an estimate at most
30
+ * `epsilon * total` above the true count, with probability `1 - delta`.
31
+ */
32
+ declare function countMinSizing(epsilon: number, delta: number): CountMinSizing;
21
33
  //#endregion
22
- export { hllSizing as i, HllSizing as n, bloomSizing as r, BloomSizing as t };
34
+ export { countMinSizing as a, bloomSizing as i, CountMinSizing as n, hllSizing as o, HllSizing as r, BloomSizing as t };
@@ -13,5 +13,13 @@ function hllSizing(relativeError) {
13
13
  if (p > 18) throw new ParamError(`relativeError ${String(relativeError)} needs precision ${String(p)}, above the maximum ${String(18)}`);
14
14
  return { p };
15
15
  }
16
+ function countMinSizing(epsilon, delta) {
17
+ assertProbability(epsilon, "epsilon");
18
+ assertProbability(delta, "delta");
19
+ return {
20
+ width: Math.ceil(Math.E / epsilon),
21
+ depth: Math.ceil(Math.log(1 / delta))
22
+ };
23
+ }
16
24
  //#endregion
17
- export { hllSizing as n, bloomSizing as t };
25
+ export { countMinSizing as n, hllSizing as r, bloomSizing as t };
@@ -13,6 +13,14 @@ function hllSizing(relativeError) {
13
13
  if (p > 18) throw new require_params.ParamError(`relativeError ${String(relativeError)} needs precision ${String(p)}, above the maximum ${String(18)}`);
14
14
  return { p };
15
15
  }
16
+ function countMinSizing(epsilon, delta) {
17
+ require_params.assertProbability(epsilon, "epsilon");
18
+ require_params.assertProbability(delta, "delta");
19
+ return {
20
+ width: Math.ceil(Math.E / epsilon),
21
+ depth: Math.ceil(Math.log(1 / delta))
22
+ };
23
+ }
16
24
  //#endregion
17
25
  Object.defineProperty(exports, "bloomSizing", {
18
26
  enumerable: true,
@@ -20,6 +28,12 @@ Object.defineProperty(exports, "bloomSizing", {
20
28
  return bloomSizing;
21
29
  }
22
30
  });
31
+ Object.defineProperty(exports, "countMinSizing", {
32
+ enumerable: true,
33
+ get: function() {
34
+ return countMinSizing;
35
+ }
36
+ });
23
37
  Object.defineProperty(exports, "hllSizing", {
24
38
  enumerable: true,
25
39
  get: function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "distillate",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "Probabilistic data structures for JavaScript. Space-efficient, approximate-membership filters (Bloom, Blocked Bloom, Binary Fuse) with tunable error and a portable binary format; zero dependencies, universal.",
5
5
  "keywords": [
6
6
  "bloom-filter",
@@ -79,6 +79,22 @@
79
79
  "import": "./dist/scalable/index.js",
80
80
  "require": "./dist/scalable/index.cjs"
81
81
  },
82
+ "./cuckoo": {
83
+ "types": {
84
+ "import": "./dist/cuckoo/index.d.ts",
85
+ "require": "./dist/cuckoo/index.d.cts"
86
+ },
87
+ "import": "./dist/cuckoo/index.js",
88
+ "require": "./dist/cuckoo/index.cjs"
89
+ },
90
+ "./countmin": {
91
+ "types": {
92
+ "import": "./dist/countmin/index.d.ts",
93
+ "require": "./dist/countmin/index.d.cts"
94
+ },
95
+ "import": "./dist/countmin/index.js",
96
+ "require": "./dist/countmin/index.cjs"
97
+ },
82
98
  "./package.json": "./package.json"
83
99
  },
84
100
  "main": "./dist/index.cjs",