UNPKG

firestore-snapshot-utils

Version:

[![github license](https://img.shields.io/github/license/ericvera/firestore-snapshot-utils.svg?style=flat-square)](https://github.com/ericvera/firestore-snapshot-utils/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/firestore-snapshot-ut

22 lines (21 loc) 854 B
/** * Normalizes data by replacing all Timestamp and Buffer objects with * standardized string representations. * * For Timestamps: /Timestamp 0000/ where the number represents the timestamp's * position in the provided sorted array. * * For Buffers: /Buffer <base64url>/ where the base64url is the * base64url-encoded value of the buffer. * * 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 and buffers replaced by their normalized * representations */ export declare const normalizeData: (value: unknown, sortedTimestamps: string[]) => unknown;