@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
29 lines (28 loc) • 1.17 kB
TypeScript
/**
* Special character constants used in JSONPointer expressions
* Based on RFC 6901 specification
* @see https://datatracker.ietf.org/doc/html/rfc6901
*/
export declare const JSONPointer: {
/**
* Root pointer representing the entire document (empty string `''`)
* @note In JSON String representation, `''` refers to the whole document.
* @note In URI Fragment representation, `#` alone refers to the whole document.
* @note `/` alone does NOT represent root - it references an empty string key `""`.
* @see https://datatracker.ietf.org/doc/html/rfc6901#section-5
*/
readonly Root: "";
/**
* Starting character of URI fragment identifier (`#`)
* @note `#` or `''` can be used as a root pointer.
* @notice if you not want to use `#` as a root pointer, just start with `/`.
* @see https://datatracker.ietf.org/doc/html/rfc6901#section-6
*/
readonly Fragment: "#";
/**
* Path separator character (`/`)
* @see https://datatracker.ietf.org/doc/html/rfc6901#section-3
*/
readonly Separator: "/";
};
export type JSONPointer = (typeof JSONPointer)[keyof typeof JSONPointer];