definitions for hat

This commit is contained in:
unknown
2018-08-28 15:39:26 +03:00
parent 00f8143ceb
commit 3a620f7ff7
4 changed files with 62 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
import * as hat from 'hat';
const randomId = hat();
const rack = hat.rack();
rack('car');
const tractorId = rack('tractor');
rack.get(tractorId);
rack.set(randomId, 'bicycle');
rack.hats;
+28
View File
@@ -0,0 +1,28 @@
// Type definitions for hat 0.0
// Project: https://github.com/substack/node-hat
// Definitions by: Sasha Grin <https://github.com/tup1tsa>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface HatsList {
[key: string]: any;
}
interface Rack {
bits: number;
base: number;
hats: HatsList;
(data: any): string;
get(id: string): any;
set(id: string, value: any): Rack;
}
type CreateRack = (bits?: number, base?: number, expandBy?: number) => Rack;
interface Hat {
(bits?: number, base?: number): string;
rack: CreateRack;
}
declare const hat: Hat;
export = hat;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"hat-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }