firestore-snapshot-utils
Version:
**Utils for testing Firestore DB snapshots**
14 lines (13 loc) • 710 B
TypeScript
/**
* Replaces all Timestamp objects in a value with normalized string representations.
* The normalized format is: /Timestamp 0000/ where the number represents the
* timestamp's position in the provided sorted array.
*
* This function is idempotent - calling it multiple times with the same input
* will always produce the same output, and it doesn't modify any input parameters.
*
* @param value - The value to process
* @param sortedTimestamps - Array of timestamp values (from valueOf()) sorted chronologically
* @returns A new value with timestamps replaced by their normalized representations
*/
export declare const replaceTimestamps: (value: unknown, sortedTimestamps: string[]) => unknown;