UNPKG

919 BTypeScriptView Raw
1export interface PointerEvaluation {
2 parent: any;
3 key: string;
4 value: any;
5}
6/**
7JSON Pointer representation
8*/
9export declare class Pointer {
10 tokens: string[];
11 constructor(tokens?: string[]);
12 /**
13 `path` *must* be a properly escaped string.
14 */
15 static fromJSON(path: string): Pointer;
16 toString(): string;
17 /**
18 Returns an object with 'parent', 'key', and 'value' properties.
19 In the special case that this Pointer's path == "",
20 this object will be {parent: null, key: '', value: object}.
21 Otherwise, parent and key will have the property such that parent[key] == value.
22 */
23 evaluate(object: any): PointerEvaluation;
24 get(object: any): any;
25 set(object: any, value: any): void;
26 push(token: string): void;
27 /**
28 `token` should be a String. It'll be coerced to one anyway.
29
30 immutable (shallowly)
31 */
32 add(token: string): Pointer;
33}