Files
DefinitelyTyped/types/object-hash/index.d.ts
Ville Lautanala 6fa7178e81 Update object-hash definitions to match version 1.1.8 (#20491)
Object-hash has added new options that weren’t included in previous
definitions based on version 0.5.0.
2017-10-11 15:44:17 -07:00

58 lines
1.4 KiB
TypeScript

// Type definitions for object-hash v1.1.8
// Project: https://github.com/puleos/object-hash
// Definitions by: Michael Zabka <https://github.com/misak113>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import HashStatic = ObjectHash.HashStatic;
export = HashStatic;
export as namespace objectHash;
declare namespace ObjectHash {
export interface IOptions {
algorithm?: string;
encoding?: string;
excludeValues?: boolean;
ignoreUnknown?: boolean;
replacer?: (value: any) => any;
respectFunctionProperties?: boolean;
respectFunctionNames?: boolean;
unorderedArrays?: boolean;
unorderedSets?: boolean;
}
interface HashTableItem {
value: any;
count: number;
}
interface HashTableItemWithKey extends HashTableItem {
hash: string;
}
export interface HashTable {
add(...values: any[]): HashTable;
remove(...values: any[]): HashTable;
hasKey(key: string): boolean;
getValue(key: string): any;
getCount(key: string): number;
table(): { [key: string]: HashTableItem };
toArray(): HashTableItemWithKey[];
reset(): HashTable;
}
export interface HashTableStatic {
(options?: IOptions): HashTable;
}
export interface Hash {
(object: any, options?: IOptions): string;
sha1(object: any): string;
keys(object: any): string;
MD5(object: any): string;
keysMD5(object: any): string;
HashTable: HashTableStatic;
}
export var HashStatic: Hash;
}