tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
12 lines • 793 B
text/typescript
/**
* Escapes a given string or number for use in Firebase database paths, with an option to preserve the path structure.
*
* This function encodes the input string or number using a custom encoding defined in the `firebaseEscape.encode()` method.
* If the `keepPath` flag is set to `true`, the function will encode each segment of the path individually.
*
* @param {string|number} text - The text or number to be escaped.
* @param {boolean} [keepPath=false] - Whether to preserve the path structure (encode each path segment separately).
* @returns {string|null} The escaped string or null if the input is neither a string nor a number.
*/
export default function databaseEscape(text: string | number, keepPath?: boolean): string | null;
//# sourceMappingURL=databaseEscape.d.mts.map