generaltranslation
Version:
A language toolkit for AI developers
27 lines (26 loc) • 1.07 kB
TypeScript
import { DataFormat, JsxChildren } from '../types';
/**
* Calculates a unique hash for a given string using sha256.
*
* First 16 characters of hash, hex encoded.
*
* @param {string} string - The string to be hashed.
* @returns {string} - The resulting hash as a hexadecimal string.
*/
export declare function hashString(string: string): string;
/**
* Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.
*
* @param {any} childrenAsObjects - The children objects to be hashed.
* @param {string} context - The context for the children
* @param {string} id - The id for the JSX Children object
* @param {string} dataFormat - The data format of the sources
* @param {function} hashFunction custom hash function
* @returns {string} - The unique has of the children.
*/
export declare function hashSource({ source, context, id, dataFormat, }: {
source: JsxChildren | string;
context?: string;
id?: string;
dataFormat: DataFormat;
}, hashFunction?: (string: string) => string): string;