@winglet/json
Version:
TypeScript library for safe and efficient JSON data manipulation with RFC 6901 (JSON Pointer) and RFC 6902 (JSON Patch) compliance, featuring prototype pollution protection and immutable operations
16 lines (15 loc) • 584 B
TypeScript
/**
* Converts AJV dataPath format to JSONPointer format.
*
* @param dataPath - AJV dataPath string to convert (e.g., "data.users[0].name")
* @returns JSONPointer format string (e.g., "/data/users/0/name")
*
* @example
* ```ts
* convertJsonPathToPointer('data.users[0].name') // '/data/users/0/name'
* convertJsonPathToPointer('items[].id') // '/items/-/id'
* convertJsonPathToPointer('[0].value') // '/0/value'
* convertJsonPathToPointer('') // '/'
* ```
*/
export declare const convertJsonPathToPointer: (dataPath: string) => string;