mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-12 19:59:02 +08:00
adds typings for the 'bloem' package
This commit is contained in:
15
types/bloem/bloem-tests.ts
Normal file
15
types/bloem/bloem-tests.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import bloem = require('bloem');
|
||||
|
||||
const base = new bloem.Bloem(1, 2, Buffer.from('1', 'hex'));
|
||||
const safe = new bloem.SafeBloem(1, 2, Buffer.from('2', 'hex'));
|
||||
const scaling = new bloem.ScalingBloem(1,
|
||||
{ratio: 1, initial_capacity: 2, scaling: 3}
|
||||
);
|
||||
|
||||
// options are optional
|
||||
const scaling2 = new bloem.ScalingBloem(1);
|
||||
|
||||
// $ExpectType number
|
||||
bloem.calculateSize(1, 2);
|
||||
// $ExpectType number
|
||||
bloem.calculateSlices(1, 2);
|
||||
39
types/bloem/index.d.ts
vendored
Normal file
39
types/bloem/index.d.ts
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// Type definitions for bloem 0.2
|
||||
// Project: https://github.com/wiedi/node-bloem
|
||||
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types= "node" />
|
||||
|
||||
export as namespace bloem;
|
||||
|
||||
export function calculateSize(capacity: number, error_rate: number): number;
|
||||
export function calculateSlices(size: number, capacity: number): number;
|
||||
|
||||
export class Bloem {
|
||||
constructor(size: number, slices: number, buffer: Buffer);
|
||||
|
||||
has(key: Buffer): boolean;
|
||||
add(key: Buffer): void;
|
||||
}
|
||||
|
||||
export class SafeBloem {
|
||||
constructor(capacity: number, error_rate: number, buffer: Buffer);
|
||||
|
||||
has(key: Buffer): boolean;
|
||||
add(key: Buffer): boolean;
|
||||
}
|
||||
|
||||
export class ScalingBloem {
|
||||
constructor(
|
||||
error_rate: number,
|
||||
options?: {
|
||||
ratio?: number;
|
||||
initial_capacity?: number;
|
||||
scaling?: number;
|
||||
}
|
||||
);
|
||||
|
||||
has(key: Buffer): boolean;
|
||||
add(key: Buffer): void;
|
||||
}
|
||||
23
types/bloem/tsconfig.json
Normal file
23
types/bloem/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bloem-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/bloem/tslint.json
Normal file
3
types/bloem/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user