43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { Options } from './options';
|
|
/**
|
|
* Result of object-hash hashing function
|
|
*/
|
|
type HashedObject = string;
|
|
/**
|
|
* Type for normalized input.
|
|
*/
|
|
export type Normalized<T> = HashedObject | T;
|
|
/**
|
|
* Class that normalizes object types to strings via hashing
|
|
*/
|
|
export declare class Normalizer<K, V, TxK, TxV> {
|
|
private readonly objectHashOptions;
|
|
private readonly caseInsensitive;
|
|
private readonly keyTransformer;
|
|
private readonly valueTransformer;
|
|
private readonly optionsChecksum;
|
|
constructor(options?: Options<K, V, TxK, TxV>);
|
|
/**
|
|
* @returns the checksum for the options passed to this Normalizer
|
|
*/
|
|
getOptionsChecksum(): string;
|
|
/**
|
|
* Normalize the input by transforming and then hashing the result (if an object)
|
|
* @param input the input to normalize
|
|
* @returns the normalized result
|
|
*/
|
|
normalizeKey(input: K): Normalized<TxK>;
|
|
/**
|
|
* Normalize the input by transforming and then hashing the result (if an object)
|
|
* @param input the input to normalize
|
|
* @returns the normalized result
|
|
*/
|
|
normalizeValue(input: V): Normalized<TxV>;
|
|
private normalizeHelper;
|
|
/**
|
|
* Returns true if the input is a javascript object.
|
|
*/
|
|
private static isObject;
|
|
}
|
|
export {};
|