UNPKG

generaltranslation

Version:

A language toolkit for AI developers

26 lines (25 loc) 1.12 kB
import { JsxChildren } from '../types'; import { HashMetadata } 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 {number} maxChars - The maxChars 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, maxChars, dataFormat, }: { source: JsxChildren | string; } & HashMetadata, hashFunction?: (string: string) => string): string;