mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Typings for fnv-lite
This commit is contained in:
parent
55a1b5699f
commit
596eb2ea46
20
types/fnv-lite/fnv-lite-tests.ts
Normal file
20
types/fnv-lite/fnv-lite-tests.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import FNV = require('fnv-lite');
|
||||
|
||||
let result: string;
|
||||
result = FNV.hex('');
|
||||
result = FNV.base64('');
|
||||
result = FNV.base64Url('');
|
||||
result = FNV.base36('');
|
||||
|
||||
result = FNV.hex([1, 2, 3]);
|
||||
result = FNV.base64([1, 2, 3]);
|
||||
result = FNV.base64Url([1, 2, 3]);
|
||||
result = FNV.base36([1, 2, 3]);
|
||||
|
||||
const fnv = new FNV();
|
||||
fnv.update([1, 2, 3]).update("abc");
|
||||
result = fnv.digest('hex');
|
||||
result = fnv.digest('base36');
|
||||
result = fnv.digest('base64');
|
||||
result = fnv.digest('base64Url');
|
||||
const resultArray: number[] = fnv.digest();
|
||||
19
types/fnv-lite/index.d.ts
vendored
Normal file
19
types/fnv-lite/index.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
// Type definitions for fnv-lite 1.2
|
||||
// Project: https://github.com/casetext/fnv-lite
|
||||
// Definitions by: MarcinD <https://github.com/marcind>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
type Input = string | ArrayLike<number>;
|
||||
|
||||
declare class FNV {
|
||||
static hex(input: Input): string;
|
||||
static base64(input: Input): string;
|
||||
static base64Url(input: Input): string;
|
||||
static base36(input: Input): string;
|
||||
|
||||
update(input: Input): this;
|
||||
digest(): number[];
|
||||
digest(type: "hex" | "base36" | "base64" | "base64Url"): string;
|
||||
}
|
||||
|
||||
export = FNV;
|
||||
23
types/fnv-lite/tsconfig.json
Normal file
23
types/fnv-lite/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",
|
||||
"fnv-lite-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/fnv-lite/tslint.json
Normal file
1
types/fnv-lite/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user