@sentry/utils
Version:
Utilities for all Sentry JavaScript SDKs
43 lines • 1.85 kB
TypeScript
/**
* Truncates given string to the maximum characters count
*
* @param str An object that contains serializable values
* @param max Maximum number of characters in truncated string (0 = unlimited)
* @returns string Encoded
*/
export declare function truncate(str: string, max?: number): string;
/**
* This is basically just `trim_line` from
* https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67
*
* @param str An object that contains serializable values
* @param max Maximum number of characters in truncated string
* @returns string Encoded
*/
export declare function snipLine(line: string, colno: number): string;
/**
* Join values in array
* @param input array of values to be joined together
* @param delimiter string to be placed in-between values
* @returns Joined values
*/
export declare function safeJoin(input: any[], delimiter?: string): string;
/**
* Checks if the value matches a regex or includes the string
* @param value The string value to be checked against
* @param pattern Either a regex or a string that must be contained in value
*/
export declare function isMatchingPattern(value: string, pattern: RegExp | string): boolean;
/**
* Given a string, escape characters which have meaning in the regex grammar, such that the result is safe to feed to
* `new RegExp()`.
*
* Based on https://github.com/sindresorhus/escape-string-regexp. Vendored to a) reduce the size by skipping the runtime
* type-checking, and b) ensure it gets down-compiled for old versions of Node (the published package only supports Node
* 12+).
*
* @param regexString The string to escape
* @returns An version of the string with all special regex characters escaped
*/
export declare function escapeStringForRegex(regexString: string): string;
//# sourceMappingURL=string.d.ts.map