UNPKG

1.3 kBTypeScriptView Raw
1/**
2 * TagEscaper escapes tag keys, tag values, and field keys.
3 * @type {Object}
4 * @property {function(s: string): string } quoted Escapes and wraps quoted
5 * values, such as database names.
6 * @property {function(s: string): string } stringLit Escapes and
7 * wraps string literals.
8 * @property {function(s: string): string } measurement Escapes measurement
9 * names on the line protocol.
10 * @property {function(s: string): string } tag Escapes tag keys, take values,
11 * and field keys on the line protocol.
12 *
13 * @example
14 * console.log(escape.quoted('my_"db')); // => "my_\"db"
15 * console.log(escape.stringLit('hello\'world')); // => 'hello\'world'
16 *
17 * console.log(escape.measurement('my measurement')); // => my\ measurement
18 * console.log(escape.tag('my tag=')); // => my\ tag\=
19 */
20export declare const escape: {
21 /**
22 * Measurement escapes measurement names.
23 */
24 measurement: (val: string) => string;
25 /**
26 * Quoted escapes quoted values, such as database names.
27 */
28 quoted: (val: string) => string;
29 /**
30 * StringLitEscaper escapes single quotes in string literals.
31 */
32 stringLit: (val: string) => string;
33 /**
34 * TagEscaper escapes tag keys, tag values, and field keys.
35 */
36 tag: (val: string) => string;
37};