UNPKG

2.18 kBTypeScriptView Raw
1export { escapeStringForRegex } from './vendor/escapeStringForRegex';
2/**
3 * Truncates given string to the maximum characters count
4 *
5 * @param str An object that contains serializable values
6 * @param max Maximum number of characters in truncated string (0 = unlimited)
7 * @returns string Encoded
8 */
9export declare function truncate(str: string, max?: number): string;
10/**
11 * This is basically just `trim_line` from
12 * https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67
13 *
14 * @param str An object that contains serializable values
15 * @param max Maximum number of characters in truncated string
16 * @returns string Encoded
17 */
18export declare function snipLine(line: string, colno: number): string;
19/**
20 * Join values in array
21 * @param input array of values to be joined together
22 * @param delimiter string to be placed in-between values
23 * @returns Joined values
24 */
25export declare function safeJoin(input: any[], delimiter?: string): string;
26/**
27 * Checks if the given value matches a regex or string
28 *
29 * @param value The string to test
30 * @param pattern Either a regex or a string against which `value` will be matched
31 * @param requireExactStringMatch If true, `value` must match `pattern` exactly. If false, `value` will match
32 * `pattern` if it contains `pattern`. Only applies to string-type patterns.
33 */
34export declare function isMatchingPattern(value: string, pattern: RegExp | string, requireExactStringMatch?: boolean): boolean;
35/**
36 * Test the given string against an array of strings and regexes. By default, string matching is done on a
37 * substring-inclusion basis rather than a strict equality basis
38 *
39 * @param testString The string to test
40 * @param patterns The patterns against which to test the string
41 * @param requireExactStringMatch If true, `testString` must match one of the given string patterns exactly in order to
42 * count. If false, `testString` will match a string pattern if it contains that pattern.
43 * @returns
44 */
45export declare function stringMatchesSomePattern(testString: string, patterns?: Array<string | RegExp>, requireExactStringMatch?: boolean): boolean;
46//# sourceMappingURL=string.d.ts.map
\No newline at end of file