UNPKG

1.85 kBTypeScriptView Raw
1/**
2 * Truncates given string to the maximum characters count
3 *
4 * @param str An object that contains serializable values
5 * @param max Maximum number of characters in truncated string (0 = unlimited)
6 * @returns string Encoded
7 */
8export declare function truncate(str: string, max?: number): string;
9/**
10 * This is basically just `trim_line` from
11 * https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67
12 *
13 * @param str An object that contains serializable values
14 * @param max Maximum number of characters in truncated string
15 * @returns string Encoded
16 */
17export declare function snipLine(line: string, colno: number): string;
18/**
19 * Join values in array
20 * @param input array of values to be joined together
21 * @param delimiter string to be placed in-between values
22 * @returns Joined values
23 */
24export declare function safeJoin(input: any[], delimiter?: string): string;
25/**
26 * Checks if the value matches a regex or includes the string
27 * @param value The string value to be checked against
28 * @param pattern Either a regex or a string that must be contained in value
29 */
30export declare function isMatchingPattern(value: string, pattern: RegExp | string): boolean;
31/**
32 * Given a string, escape characters which have meaning in the regex grammar, such that the result is safe to feed to
33 * `new RegExp()`.
34 *
35 * Based on https://github.com/sindresorhus/escape-string-regexp. Vendored to a) reduce the size by skipping the runtime
36 * type-checking, and b) ensure it gets down-compiled for old versions of Node (the published package only supports Node
37 * 12+).
38 *
39 * @param regexString The string to escape
40 * @returns An version of the string with all special regex characters escaped
41 */
42export declare function escapeStringForRegex(regexString: string): string;
43//# sourceMappingURL=string.d.ts.map
\No newline at end of file